Start 2025 on time and up to date. Seamlessly integrate your calendars into Dropbox with these simple steps.

Forum Discussion

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

Is it possible to get a permanent token for uploading files to one specific account?

I have the following workflow in my application I am generating some files and I am saving it to a dropbox account, the files are only saved to one specific account and the app and account are under...
  • Greg-DB's avatar
    2 years ago

    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 and can be store and re-used repeatedly. While you do need to use the OAuth app authorization flow to get a refresh token, this only needs to be done once per account. 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.
     
    For examples of implementing this with the Dropbox JavaScript SDK, please refer to the examples included in the "examples" folder in the SDK. As long as you supply the necessary credentials, for instance, set the app key (a.k.a. client ID) and refresh token, like shown in this example for the JavaScript SDK, the SDK will actually handle refresh process for you automatically. (Note that the app secret is also required if the app does not use PKCE.) The SDK will automatically catch expired access token errors and call the API to get a new short-lived access token when needed.