401 Error on request_token "Failed to validate oauth signature and token"


#1

Hi,

I’m working on a web application that requires twitter integration, and I’m failing when trying to get an access token. I get a 401 error with the message “Failed to validate oauth signature and token.” I’m not sure where I’m slipping up. I’ve tested my signing procedure using the sample data on the site, and it appears to be generating the correct signature.

Here is a sample signature base string I’m generating:

POST&https%3A%2F%2Fapi.twitter.com%2Foauth%2Frequest_token&oauth_callback%3Doob%26oauth_consumer_key%3DQRyK5Rz3EhHh2QgjqbCbiA%26oauth_nonce%3Dc4a0c240b96911e1a14dcd0663c7d609%26oauth_signature_mehtod%3DHMAC-SHA1%26oauth_timestamp%3D1340039971%26oauth_version%3D1.0

I’m making a POST to this URL, with the following Authentication header.

https://api.twitter.com/oauth/request_token
Authorization:  OAuth oauth_callback="oob", oauth_consumer_key="QRyK5Rz3EhHh2QgjqbCbiA", oauth_timestamp="1340040370", oauth_nonce="b2194ce0b96a11e1b59a251df3e7517a", oauth_signature_method="HMAC-SHA1", oauth_version="1.0", oauth_signature="Gf5TjH9w161P4n4Q6tyV0Uixu2I%3D"

Any ideas as to what I’m missing?


#2

At first glance this looks correct from what I can tell. I would make sure that your timestamp is correct and close to our own (we return a Date HTTP header that will have our current time). Is there anything else special about how the request is executed? Are you using a library for this?


#3

“oauth_signature_mehtod” ?


#4

The same is the problem faced by me. . .Do anybody know the cause?