php - How to resolve "Invalid signature. Expected signature base string" in OAuth 1.0
I'm attempting to get an access token and secret from a site using OAuth. The exchange of request token and request secret goes fine, but when it comes time to get the access tokens I get the error"Invalid signature. Expected signature base string."
Has anyone seen this error before or know what might be wrong? Here is the data I am getting back (afterurldecode
-ing it):
Invalid signature. Expected signature base string: POST
https://www.readability.com/api/rest/v1/oauth/access_token
oauth_consumer_key=my_consumer_key
oauth_nonce=d9aff6a0011a633253c5ff9613c6833d79d52cbe
oauth_signature_method=HMAC-SHA1
oauth_timestamp=1311186899
oauth_token=C8GF7D6ytPzQKdZVpy
oauth_verifier=ncUV4tJSrS
oauth_version=1.0
signature=7jUuk6fsEL8XNYxVWcsfGXEreK0%3D
Answer
Solution:
As @genesis described, it is pretty painful to get the signature key right, but there are documentation for it, which can be seen on this link http://oauth.net/core/1.0/#encoding_parameters.
The rule of thumbs is when you work with HMAC-SHA1,
Source: http://nouncer.com/oauth/authentication.html
Answer
Solution:
you can take a look here, it was asked about a week ago. Response:
Answer
Solution:
I can't comment on answers for some reason, but to answer your question in the comment on the answer above, you can use the Oauth playground to see what google wants your base string to look like. http://googlecodesamples.com/oauth_playground/index.php
Answer
Solution:
I know this is really old, and this might not help in the slightest, but I got this with something today, and doing a
rawurlencode()
instead ofurlencode()
fixed it for me.Answer
Solution:
I was facing that aouth 1.0 problem recently after searching google I found a web service created by someone which generates signature for oauth. It worked for me. link is here. Have a look :)