Twitter API oAuth添加回调URL时失败签名 [英] Twitter API oAuth failed signature when adding callback url

查看:288
本文介绍了Twitter API oAuth添加回调URL时失败签名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用此代码/指南的另一个twitter oAuth cURL访问令牌请求失败测试签署我对API的请求。我仍然试图去通过这个rel=\"nofollow\">

I'm using this code/guide another twitter oAuth cURL access token request that fails to test signing my request to the API. I'm still trying to go through step 1 of this

注意:键是随机的,它们不是真的:)

我尽量让没有oauth_callback请求我从API

when I try to make a request without oauth_callback I get a valid response from the api

https://api.twitter.com /oauth/request_token?oauth_consumer_key=nHb2kSQ2CD9MW1MdW5VeQ&oauth_nonce=1356902849&oauth_signature=MbvhwGiNPKQR0klUPx9fsmUtdJY%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1356902849&oauth_version=1.0

当我添加了oauth_callback字符串(强制让用户重定向符号!)我得到无法验证OAuth的签名和记号

when I add the oauth_callback string (mandatory to let users sign with a redirect!) I get "Failed to validate oauth signature and token"

https://api.twitter.com/oauth/request_token?oauth_callback=http% 3A%2F%2F127.0.0.1%2Ftest%2F&安培; oauth_consumer_key = nHb2kSQ2CD9MW1MdW5VeQ&安培; oauth_nonce = 1356902915&安培; oauth_signature = 2WTaI9jXNBaDd7f8AqIe6y3%2Beno%3D&安培; oauth_signature_method = HMAC-SHA1和放大器; oauth_timestamp = 1356902915&安培; oauth_version = 1.0

我的意思是两个URL没有区别,它们都经历相同的执行,他们尊重签名方法。
如何解决?

I mean there's no difference between the two URLs, they both go through the same execution and they respect the signing method. How to fix it?

是我加入 http://127.0.0.1/test/ 作为Twitter的应用程序设置的回调URL。

yes I added http://127.0.0.1/test/ as callback url in the twitter app settings.

感谢您

推荐答案

我解决了这个问题。问题是,即使使用querystring方法或标头正确发送回调URL,您可以在链接上看到,在从basestring创建签名时,它也被双重转义。因为文档是非常糟糕的关于这一点,我不认为你不应该双重转义,以及像其他oauth_ *参数(aka百分比编码的&)。

I solved the issue. The problem was that even though the callback URL was sent correctly using the querystring method or headers as you can see on the links, it was also double escaped when creating the signature from the basestring. Since the documentation is pretty bad regarding this I didn't think that you shouldn't double escape it as well like other oauth_* parameters (aka percentage encode the "&"s).

这篇关于Twitter API oAuth添加回调URL时失败签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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