Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do twitter access token expire?

I am building a web app from where the user can manage his twitter account. I've created the twitter app and once the user authenticates himself the application gets the access token from twitter. Does this access token expire or I can store it and make request, on user's behalf, without asking from him to log in again ?

like image 678
Florian Shena Avatar asked Dec 02 '11 14:12

Florian Shena


People also ask

How long is an access token valid for?

By default, access tokens are valid for 60 days and programmatic refresh tokens are valid for a year. The member must reauthorize your application when refresh tokens expire.

What happens when access token expires?

When the access token expires, the application will be forced to make the user sign in again, so that you as the service know the user is continually involved in re-authorizing the application.

How do I get my Twitter authentication token?

Generating access tokensLogin to your Twitter account on developer.twitter.com. Navigate to the Twitter app dashboard and open the Twitter app for which you would like to generate access tokens. Navigate to the "Keys and Tokens" page. Select 'Create' under the "Access token & access token secret" section.

Do Instagram access tokens expire?

Refreshed tokens are valid for 60 days from the date at which they are refreshed. Tokens that have not been refreshed in 60 days will expire and can no longer be refreshed. Long-lived access tokens for private Instagram accounts can now be refreshed.


2 Answers

Here is what they saying in there development page

Question: How long does an access token last?

Access tokens are not explicitly expired. An access token will be invalidated if a user explicitly revokes an application in the their Twitter account settings, or if Twitter suspends an application. If an application is suspended, there will be a note in the Twitter app dashboard stating that it has been suspended.

More details can be found here

FAQ Twitter

like image 142
Umesh Awasthi Avatar answered Oct 17 '22 16:10

Umesh Awasthi


From the Twitter API error codes it looks like it can expire:

API request contains invalid bearer token Using an incorrect or revoked bearer token to make API requests will result in:

HTTP/1.1 401 Unauthorized Content-Type: application/json; charset=utf-8 Content-Length: 61 ...

{"errors":[{"message":"Invalid or expired token","code":89}]}

Source link: https://dev.twitter.com/oauth/application-only

like image 25
Dan Ochiana Avatar answered Oct 17 '22 15:10

Dan Ochiana