twitter开发者控制台和twitter oauth工具(twitter developer console and twitter oauth tool)

我试图从twitter获取请求令牌,我一直遇到一些问题。 我使用twitter4J来查看它是否适用,但是当我使用twitter oauth工具获取有效的授权标题时,将其复制并粘贴为http://api.twitter.com/的授权标题Twitter开发者控制台中的oauth / request_token我收到401错误(“无法验证签名和令牌”)。 我已经为需要身份验证的其他请求尝试了相同的复制和粘贴方法,但它可以正常工作,但它不适用于此请求。 关于发生了什么的任何建议?

I am trying to get a request token from twitter, and I've been having some problems with it. I used twitter4J to see if it would work with that and it does, but when I use the twitter oauth tool to get a valid authorization header, and copy and paste it as the authorization header for http://api.twitter.com/oauth/request_token in the twitter developer console I get a 401 error ("failed to validate signature and token"). I have tried this same copy and paste method for other requests that require authentication and it works but it just won't work for this request. Any suggestions as to what is going on?

最满意答案

好吧我明白了! 问题是当您使用twitter oauth工具时,oauth访问令牌包含在标题中,访问令牌是与您的应用程序相关的Twitter帐户的访问令牌。 但是,如果您使用的是request_token url,那么您应该已经没有了,这就是它抛出错误的原因。 因此,对于对此URL的请求,twitter oauth工具是无用的。

Ok I figured it out! The problem was that the oauth access token is included in the header when you use the twitter oauth tool, with the access token being that of the twitter account related to your application. But if you are using the request_token url you shouldn't already have that, and that is why it throws the error. Thus the twitter oauth tool is useless for a request to this url.

更多推荐