Forum Discussion

SuryaMopuru's avatar
SuryaMopuru
Explorer | Level 3
3 years ago

What is the best way to check access token is expired

I need to know the most appropriate way to check my access token is expired or not? Can anyone suggest with an example

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    When you retrieve a short-lived access token via /oauth2/token, the response includes the expiration information in the 'expires_in' field. You can store and refer to that information to check if the short-lived access token would be expired at any point in time.

     

    To actively check if any particular access token is still valid though, you would need to perform an API call. For example, for user-linked access tokens, calling /2/check/user or /2/users/get_current_account would be good options, as those don't have any side effects. (Likewise, for team-linked access tokens, you could use /2/team/get_info.)

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,941 PostsLatest Activity: 6 days ago
351 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!