Reputation: 1753
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
when I add the oauth_callback string (mandatory to let users sign with a redirect!) I get "Failed to validate oauth signature and token"
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
Upvotes: 5
Views: 3934
Reputation: 11
Agreed that twitter API is badly documented :)
Follow this rule:
Hope this explains.
Upvotes: 1
Reputation: 1753
I solved the issue. The problem was that even though the callback URL was sent correctly using the querystring method or headers as you can see on the links, it was also double escaped when creating the signature from the basestring. Since the documentation is pretty bad regarding this I didn't think that you shouldn't double escape it as well like other oauth_* parameters (aka percentage encode the "&"s).
Upvotes: 0
Reputation: 8847
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:
Also check that your time is in sync (use an NTP server); see: https://dev.twitter.com/discussions/1043
Upvotes: 1