Do twitter access token expire?

萝らか妹 提交于 2019-12-18 10:59:28

问题


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 ?


回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/8357568/do-twitter-access-token-expire

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!