Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter API oAuth failed signature when adding callback url

I'm using this code/guide another twitter oAuth cURL access token request that fails to test signing my request to the API. I'm still trying to go through step 1 of this

Note: the keys are just random, they're not real :)

when I try to make a request without oauth_callback I get a valid response from the api

https://api.twitter.com/oauth/request_token?oauth_consumer_key=nHb2kSQ2CD9MW1MdW5VeQ&oauth_nonce=1356902849&oauth_signature=MbvhwGiNPKQR0klUPx9fsmUtdJY%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1356902849&oauth_version=1.0

when I add the oauth_callback string (mandatory to let users sign with a redirect!) I get "Failed to validate oauth signature and token"

https://api.twitter.com/oauth/request_token?oauth_callback=http%3A%2F%2F127.0.0.1%2Ftest%2F&oauth_consumer_key=nHb2kSQ2CD9MW1MdW5VeQ&oauth_nonce=1356902915&oauth_signature=2WTaI9jXNBaDd7f8AqIe6y3%2Beno%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1356902915&oauth_version=1.0

I mean there's no difference between the two URLs, they both go through the same execution and they respect the signing method. How to fix it?

yes I added http://127.0.0.1/test/ as callback url in the twitter app settings.

Thank you

like image 501
Sandro Antonucci Avatar asked Nov 03 '22 07:11

Sandro Antonucci


1 Answers

Have you set up the callback url in the twitter application settings?

If you don't set that up, the api may fail.

Check it from here:

enter image description here

Also check that your time is in sync (use an NTP server); see: https://dev.twitter.com/discussions/1043

like image 161
Luigi R. Viggiano Avatar answered Nov 15 '22 12:11

Luigi R. Viggiano