Search code examples
access-tokendropbox-api

How can i generate a dropbox api access token that doesnt expire?


Is it possible to generate an access token for DropBox API access that does not expire?

By happenstance I discovered that the generated access token lasts only a few hours and is intended for developer testing only.

I would like to obtain an access token (long or short-lived) without presenting the user with a confirmation page followed by a redirect.

Can this be achieved?

Update So far i am seeing that this is not possible. https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/C-Get-Access-Token-without-browser-interaction/td-p/622443

enter image description here


Solution

  • Dropbox does not offer a way to fully automate this process. The user needs to manually authorize the app at least once.

    Note that Dropbox is no longer offering the option for creating new long-lived access tokens. Dropbox is now 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. Refresh tokens do not expire automatically and can be used repeatedly, so you would not need to manually reauthorize the app each time. 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.