Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

Agrometius_Smart_Farming's avatar
Agrometius_Smart_Farming
Explorer | Level 3
5 years ago

Server-side application with NO way to use the standard OAuth flow

One of our server-side applications should be able to access all of our Dropbox Business files. This application is exclusively meant for use by our own organization, for background file handling, meaning that we are not planning to ever "Apply for production" (= open up to external users) this app through Dropbox's App console.

 

Right now we're using a Generated access token (No expiration).

And we pass that long-lived token to the DropboxClient constructor that's in the Dropbox SDK for .NET 

 

using (var client = new DropboxClient(oauth2Token))
{
  // Perform actions here
}
 
I've read that long-lived tokens are deprecated, although there are no concrete plans yet(?) to actually disable them.
 
Still I'd like to know: can we switch to a short-lived token today? 
Which we also generate through the App console and pass to the DropboxClient in the same way. But now also get a Refresh Token that's needed to replace the short-lived token, as soon as it expires. All without involving a user (i.e. have no interactive OAuth flow at all).
 
Or should we simply not worry about this until the long-lived tokens are actually announced to be disabled by the Dropbox team?
 
Thanks,
Richard
 

5 Replies

  • kylea's avatar
    kylea
    Icon for Dropbox Staff rankDropbox Staff
    5 years ago

    Applying for production is only required if your application intends to link more than 50 users.

     

    Your application may use refresh tokens to retrieve new access tokens without needing to apply for production access. Refresh tokens do not expire; you may pass them to the SDK which will then automatically retrieve new access tokens as required. You can switch to this methodology now.

     

    You will need to complete an OAuth to retrieve a refresh token; they are not returned in the 'generate access token' section of the developer console.  This OAuth will only be required once (per account) to retrieve a refresh token.

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

    RosenPetrov The examples you linked to are the current samples for implementing the OAuth app flow with the Dropbox .NET SDK. Are they not working for you, or can you clarify what you're stuck on?

  • Rosen Petrov's avatar
    Rosen Petrov
    Explorer | Level 4
    5 years ago

    Hi,

    I am looking into the 'SimpleTest' and I see these LoopbackHost, RedirectUri and JSRedirectUri but in my case I need this Authentication to happen in a background without user interaction. Could you point me in the right direction how I could accomplish that. Maybe some high level steps but not code would be enough. 

    Thanks 🙂 

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

    Rosen Petrov It is not possible to get authorization to access an account purely via a background process. Authorizing an app requires manual user interaction the first time, for the user to indicate to Dropbox that they want to allow the app to access their account. After that though, the app can store and re-use the resulting access token and optional refresh token to make further API calls without further manual user interaction. I recommend reading the OAuth Guide for more information on how this process works at a high level.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

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, Facebook or Instagram.

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!