What to do with long lasting access tokens?


#1

Hi,

I am using Abraham Williams twitterauth library to try and sort oauth access to the twitter api.

I have got the example working fine, but I really confused as to that the point of the long lasting credentials are. At the moment I retrieve these and have stored them in a database. I thought that with this, I would be able to cut out the temp token requests and make much quicker calls to the API using

new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, ‘$oauth[‘perm_access_token’]’, $oauth[‘perm_access_secret’]);

Obviously retrieving the access token and access secret from the database.

When I try this, I am getting nothing in return. No error, but no http_response code.

Can someone please explain how to access the API with the proper token/secret?

Thanks


#2

This is the correct way. If you’re not getting an error and also no http response code, perhaps you’re not making an API request? That code line has given yourself an OAuth consumer object, but doesn’t actually make an API request…