You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

dbmt's avatar
dbmt
New member | Level 2
10 months ago

Cannot refresh short-lived access tokens, node.js

I have a web-app that processes images and uploads them to a single dropbox folder (My account). I have an App for my web app in dropbox and I am successfully able to upload images to said folder. 

The access tokens to the folder expire every four hours, and I am having trouble understanding the OAuth options that will work in my case. It would seem that most options to acquire a new access token requires user input which should not be required if I all I am doing is uploading images.

 

I have tried  using oauth2/token but this requires an authorization code that is limited to one use and will not work in my case.

 

I simply need an access token to my dropbox account that I can refresh whenever the old token has expired. Any direction would be helpful as I am lost.

 

  • dbmt As Здравко indicated, you would need a refresh token to maintain long-term unattended access.

     

    Dropbox issues short-lived access tokens, which expire after a few hours, and optional refresh tokens, which don't expire. Apps can get long-term access by requesting "offline" access, 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. 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.

     

    The official Dropbox SDKs can also handle the refresh process for you automatically. If you're using one of the official Dropbox SDKs, refer to its corresponding documentation and examples for information on how to use it.

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

      Hi dbmt,

      Take a look here if you want to know how exactly refreshing works. You'll need only the refresh token there though. Initialization of SDK in correct way would be enough.

      Hope this helps.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,888 PostsLatest Activity: 24 hours ago
326 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!