Forum Discussion

shinestar9101987's avatar
shinestar9101987
New member | Level 2
2 years ago

Generate Access Token Automatically using Code

HI Friends

i am using Dropbox API in webapi which needs access token which have the validity only few hours so that  i have to on console and generate again the token.

So is this possible to use same token again or Generate new token using api without going to browser?

  • Здравко's avatar
    Здравко
    Legendary | Level 20

    Hi shinestar9101987,

    You need refresh token for long term access since long lived access token was dropped. Currently all new access token are short lived. Here you can see an example how refresh token bahaves. Once you get to a refresh token, you can use it to initialize SDK client object. Take a look on the corresponding SDK's examples.

    Hope this helps.

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

    shinestar9101987 Здравко is correct, Dropbox is no longer offering the option for creating new long-lived access tokens. Dropbox is switching to only issuing short-lived access tokens (and optional refresh tokens) instead of long-lived access tokens. You can find more information on this migration here.

    Apps can still get long-term access by requesting "offline" access though, in which case the app receives a "refresh token" that can be used to retrieve new short-lived access tokens as needed, without further manual user intervention. You can find more information in the OAuth Guide and authorization documentation. There's a basic outline of processing this flow in this blog post which may serve as a useful example.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,950 PostsLatest Activity: 17 hours 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!