We Want to Hear From You! What Do You Want to See on the Community? Tell us here!

Forum Discussion

ganeshpuli3's avatar
ganeshpuli3
Explorer | Level 3
4 years ago

How can we handle if the dropbox short living accesstoken expires in the middle of the API Request?

How can we handle if the dropbox short living accesstoken expires in the middle of the API Request?

here the scenario totally explained :- 

 

dropbox short lived access token have expiring time is 4 hours

user logged in to the our dropbox api consuming application before 1 hour of access token expiring

and user uploading some files at before 1 minute of access token expires (i.e. at 3 hr 59 minute)

and the request is going to take 3 minutes approaximately

here in the middle of the api call or request access token expired

example :- user uploading 10 files into dropbox

after 5 files uploading, if dropbox access token expires then how can we handle this situation

(i.e how can we resume this operation of remaining 5 files uploading process into dropbox by getting new access token)

 

Thanks & Regards, 

Ganesh

1 Reply

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    4 years ago

    You do not need to apply any special logic for the expiration of an access token near the boundary of the expiration time; the Dropbox API servers will authenticate each request and either allow or reject it. For any given API request, the request will either be authenticated and then proceed, or it will not (e.g., if the access token is expired) and the call will be rejected. The call will be authenticated at the beginning of the request, and then the file upload will proceed. As long as you receive a successful API response, then the file was uploaded. If you receive an API error, then the file was not uploaded.

     

    If the call is rejected, indicating that the short-lived access token is expired, you should then get a short-lived new access token for further calls. You can do so by having the user re-authorize the app, or if your app requested "offline" access, use the refresh token to get a new short-lived access token programmatically. You can find more information in the OAuth Guide and authorization documentation.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,035 PostsLatest Activity: 7 years ago
410 Following

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

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!