Oauth/request_token not working all of a sudden


#1

My app has been working for the last couple months and all of sudden I’m getting “401 Authorization Required” responses to my Oauth/request_token request. I haven’t made any changes to the code. What’s going on? Is there any way to get any further detail so I can begin troubleshooting this issue?

Here’s the data I’m sending with the request

Endpoint
https://api.twitter.com/oauth/request_token

Post Data

["oauth_callback"] = "oob"

Header

["Authorization"] = "OAuth oauth_consumer_key=\"LxVtUKQh8Eagshrx8GGkczrGe\",
oauth_nonce=\"659e6b46d9be4b35af2e94b965fd120e\",
oauth_signature=\"hwYwE%2Bc4QeXsmFPpjjyql9Ue0mU%3D\",
oauth_signature_method=\"HMAC-SHA1\",
oauth_timestamp=\"1434257039\",
oauth_version=\"1.0\""

When I use Twitter’s Oauth tool to generate the header, it looks the same to me…

Authorization: OAuth oauth_consumer_key="LxVtUKQh8Eagshrx8GGkczrGe", 
oauth_nonce="6c0231627bd588ea33069a3e9f1e6645", 
oauth_signature="yS4S%2BxvuapTQNHHSB5SAXrlb1PE%3D", 
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="1434297358", 
oauth_version="1.0"

Other things I’ve tried

  • When I run the cURL command generated by Twitter’s Oauth tool, it works.
  • I regenerated my consumer key and secret, that didn’t fix anything.
  • I also tried creating a new test app, but that didn’t work either.

I should note that my client app is using PIN-based authorization. Again, the code hasn’t changed, this endpoint just stopped working. HELP!

Thanks!


#2

Are you running the code on the same host as where you’re executing the curl command?
If not, can you check that the time hasn’t drifted on the machine where you’re running the code?


#4

I found the problem, it was time drift. Thanks for your help!