雅虎返回“signature_invalid”当我使用 OAuth 时
我正在尝试允许我网站的用户使用他们的 Yahoo/Gmail 帐户登录。
Gmail 一切顺利。但在雅虎我有以下 php 片段:
$this->options = array('consumer_key' => 'My Key from Yahoo', 'consumer_secret' => 'My Secret ', 'server_uri' => 'https://www.yahoo.com', 'request_token_uri'=> 'https://api.login.yahoo.com/oauth/v2/get_request_token', 'authorize_uri' => 'https://api.login.yahoo.com/oauth/v2/request_auth', 'access_token_uri'=> 'https://api.login.yahoo.com/oauth/v2/get_token',); $getAuthTokenParams = array( 'xoauth_lang_pref' => 'en-us', 'oauth_callback' => $this->callback_url);//callback to my page $tokenResultParams = OAuthRequester::requestRequestToken($this->options['consumer_key'], 0, $getAuthTokenParams);
现在雅虎给出
HTTP/1.1 401 Forbidden Date: Wed, 27 Jul 2011 09:12:19 GMT P3P: policyref="http://info.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC GOV" WWW-Authenticate: OAuth oauth_problem=signature_invalid Connection: close Transfer-Encoding: chunked Content-Type: application/x-www-form-urlencoded oauth_problem=signature_invalid
https://developer.apps.yahoo.com /projects 我选择了:
delicious social bookmarking (read/write) Contacts (read) Social Directory (read/write)
有人遇到同样的问题吗?我做错了什么吗?
感谢您的帮助
I am trying to allow users of my website to login using their Yahoo/Gmail accounts.
Gmail went fine. but in Yahoo i have the following php snippet:
$this->options = array('consumer_key' => 'My Key from Yahoo', 'consumer_secret' => 'My Secret ', 'server_uri' => 'https://www.yahoo.com', 'request_token_uri'=> 'https://api.login.yahoo.com/oauth/v2/get_request_token', 'authorize_uri' => 'https://api.login.yahoo.com/oauth/v2/request_auth', 'access_token_uri'=> 'https://api.login.yahoo.com/oauth/v2/get_token',); $getAuthTokenParams = array( 'xoauth_lang_pref' => 'en-us', 'oauth_callback' => $this->callback_url);//callback to my page $tokenResultParams = OAuthRequester::requestRequestToken($this->options['consumer_key'], 0, $getAuthTokenParams);
now Yahoo gives
HTTP/1.1 401 Forbidden Date: Wed, 27 Jul 2011 09:12:19 GMT P3P: policyref="http://info.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC GOV" WWW-Authenticate: OAuth oauth_problem=signature_invalid Connection: close Transfer-Encoding: chunked Content-Type: application/x-www-form-urlencoded oauth_problem=signature_invalid
in https://developer.apps.yahoo.com/projects i have selected:
delicious social bookmarking (read/write) Contacts (read) Social Directory (read/write)
has anybody faced the same problem? have i done anything wrong?
Thanks for your help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如我昨天发现的那样,雅虎的代币非常巨大。这意味着 oauth-php 不能很好地存储它,因此您会得到错误的签名。这是我对问题的解决方案: 如何使用雅虎!带有 oauth-php 库的 API?
As I found yesterday, yahoo's token are huge. Meaning that oauth-php does not store it well so you get bad signature. Here is my solution to the problem: How to use the Yahoo! API with the oauth-php library?