开发者

Not getting the access token in google oauth

开发者 https://www.devze.com 2023-03-27 00:16 出处:网络
I got the token verifier, i couldn\'t get the access token. When i send a request to this link: /accounts/OAuthGetAccessToke开发者_如何学Cn

I got the token verifier, i couldn't get the access token.

When i send a request to this link: /accounts/OAuthGetAccessToke开发者_如何学Cn

The response from the server is:

Invalid String: base string.

Couldn't guess what's wrong

This is the parameter i am sending to create Signature:

$arrParam = array('oauth_consumer_key'=>$this->strConsumerKey,'oauth_nonce'=>$this->strOauthNonce,'oauth_signature_method'=>'HMAC-SHA1','oauth_timestamp'=>$this->strTimestamp,'oauth_version'=>'1.0','scope'=>rawurlencode('http://finance.google.com/finance/feeds/'),'oauth_callback'=>rawurlencode('http://www.finfore.com/prem_test/google.php'));

And these are the post fields i am sending:

$strPostField = 'oauth_consumer_key='.urlencode($this->strConsumerKey).'&oauth_signature_method=HMAC-SHA1&oauth_signature='.urlencode($strSignature).'&oauth_timestamp='.$this->strTimestamp.'&oauth_nonce='.$this->strOauthNonce.'&oauth_version=1.0&scope='.urlencode('http://finance.google.com/finance/feeds/').'&oauth_callback='.urlencode('http://www.finfore.com/prem_test/google.php');


Could you post your request/response headers? You can use the developer tools in Google Chrome to grab these (Network tab), or something like firebug in Firefox.

Compare your headers with ones generated by: Google OAuth Playground

Might also need to set GData-Version: 3.0 as an additional request header - not really should when/why this is required but I believe some of the Google API requires it.

You could always try using a library instead, something like OAuth-PHP, alternatives and example code can be found here: OAuth Code

Hope that helps

0

精彩评论

暂无评论...
验证码 换一张
取 消