I’m at the bottom of the learning curve for using the REST API v1.1.
Here’s what I’ve done so far, and a description of the sumbling block which has completely defeated me:
I created an App, then given it “read, write and directe messages” permissions. Then I regenerated the API keys and OAuth tokens.
I downloaded the Abraham Twitter OAuth library from https://github.com/abraham/twitteroauth. I cannot get any of the function calls to work. The all report “invalid or expired token”.
I went to the app management page for my app and clicked “Test OAuth”.
I want to test it with something simple, so under Request Settings, I choose Request Type “GET” and Request Query “account/verify_credentials”.
Then I click “see OAuth Signature for this request”.
Among the data that is presented to me, I see the curl command to use. It looks like this (edited to hide the keys and the signature):
curl --get 'https://api.twitter.com/1.1/' --data 'account%2Fverify_credentials=' --header 'Authorization: OAuth oauth_consumer_key="XXXXXXXXXXXXXXXXXXXX", oauth_nonce="f187b1a421600e88ffebeed19b6c1fbf", oauth_signature="XXXXXXXXXXXXXXXXXX", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1399538823", oauth_token="XXXXXXXXXXXXXXXXXXXXXXXX", oauth_version="1.0"' --verbose
So, I copy-and-paste this IMMEDIATELY (i.e. so that the timestamp does not expire) to my terminal (I’m using Debian), and I get the following response (again, edited to remove keys and signature), where you can see down the bottom it says, once again, “Invalid or expired token”:
What confuses me completely is that I have submitted Twitter’s own curl command back to Twitter and it has rejected it!!!
Any ideas??? I am completely stuck at this point.