雅虎返回“signature_invalid”当我使用 OAuth 时

发布于 2024-11-26 22:26:22 字数 1508 浏览 6 评论 0原文

我正在尝试允许我网站的用户使用他们的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

素年丶 2024-12-03 22:26:22

正如我昨天发现的那样,雅虎的代币非常巨大。这意味着 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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文