当我使用OAuth时,Yahoo返回“signature_invalid”

时间:2011-07-27 09:24:35

标签: oauth yahoo-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)

有人遇到同样的问题吗?我做错了什么吗? 谢谢你的帮助

1 个答案:

答案 0 :(得分:1)

正如我昨天发现的那样,雅虎的代币是巨大的。这意味着oauth-php不能很好地存储它,所以你会得到糟糕的签名。以下是我对此问题的解决方案:How to use the Yahoo! API with the oauth-php library?