We're making changes to the Community, so you may have received some notifications - thanks for your patience and welcome back. Learn more here.

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.

 

    • Здравко'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.

  • 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.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,875 PostsLatest Activity: 21 days ago
323 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!