在 Twitter OAuth POST 请求上获取 401 [英] Getting 401 on Twitter OAuth POST requests

查看:66
本文介绍了在 Twitter OAuth POST 请求上获取 401的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Twitter OAuth,但我的 POST 请求失败,出现 401(无效的 OAuth 请求)错误.

I am trying to use Twitter OAuth and my POST requests are failing with a 401 (Invalid OAuth Request) error.

例如,如果我想发布一个新的状态更新,我会向 https://twitter.com/statuses/update.jsonPOST 请求> 带有以下参数 -

For example, if I want to post a new status update, I am sending a HTTP POST request to https://twitter.com/statuses/update.json with the following parameters -

status=Testing&oauth_version=1.0&oauth_token=xxx&
oauth_nonce=xxx&oauth_timestamp=xxx&oauth_signature=xxx&
oauth_consumer_key=xxx&in_reply_to=xxx&oauth_signature_method=HMAC-SHA1`

我的 GET 请求都工作正常.我可以在邮件列表上看到很多人都遇到了相同的问题,但我在任何地方都找不到解决方案.

My GET requests are all working fine. I can see on the mailing lists that a lot of people have had identical problems but I could not find a solution anywhere.

我正在使用 oauth.py Python 库.

I am using the oauth.py Python library.

推荐答案

很可能是签名无效.您必须遵循有关如何生成签名的 OAuth 规范(规范化参数、URLencoding 和 cosumerSecret&oauthScret.稍后会详细介绍......

Most likely, the signature is invalid. You must follow the OAuth spec on how to generate the signature( normalized parameters, URLencoding, and cosumerSecret&oauthScret. More on this later ......

这篇关于在 Twitter OAuth POST 请求上获取 401的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆