Discuss Dropbox Developer & API
Hi All,
Good day...!!!
I'm Nitish Kumar from India. I'm a software engineer. Currently, I'm working on one of the projects using node js where I'm using dropbox API with the access token. everything was working fine but after a while, the access token is getting expired. I need a way to get the permanent access token so, I do not require manual intervention every time.
So, the team can you please help me with the same? thank you!
Thanks and regards,
Nitish Kumar
<contact information redacted>
@MG2L Здравко is correct; the Dropbox JavaScript SDK does perform the refresh process for you automatically as long as you provide the necessary credentials (e.g., the refresh token), as shown the example. (You can also call refreshAccessToken in the SDK explicitly if you want to for whatever reason, but it's not necessary.) And as Здравко illustrated, you have to use the OAuth app authorization flow to get a refresh token.
Also, you can technically use getAuthenticationUrl without a redirect URI, by setting the parameter to null, as long as you're using the "code" flow (e.g., as shown in that example). In that case, the user would just need to manually copy/paste the resulting authorization code back into the app.
Hi
First of all thank you very much for your help.
I noted dropbox node sdk will refresh automatically my token if it expires.
I sucessfully tryed the manual procedure provided by Здравко (request url in my browser, perform curl request to get code and use it in my backend) but I can't request a "code" from my backend while the request form will wait for an the form to be validated. So I still do not understand how to connect the first time (after each deployment) using the node SDK.
In all usecases I already encountered in my developer life (;-)), I usually need to provide a clientId/clientSecret most often encrypted in base64 (concat with special char between) and the SDK will automatically handle all auth stuff (auth -> refresh_token -> expiration -> new refresh token).
In my mind, I just need to create my Dropbox objet with appropriate parameters and the sdk magically do the rest. In other words my backend must handles the authentication process by itself without human intervention to provide a code.
Maybe I missed something somewhere on your answers :S
Maybe there is some piece of code somewhere ?
Or maybe there is a way to generate a permanent access token with manual procedure ?
Thank you again for your help. It is really appreciated ![]()
@MG2L The user does need to process the app authorization flow manually at least once to authorize the app. That produces an authorization code that can be used once to retrieve the access token and optional refresh token. The refresh token can be stored and re-used without manual user interaction though. Even if you are the only user of your app, you'll need to do that manually once. In addition to the outline that Здравко linked to, you can see an example of the OAuth app authorization flow implemented with the JavaScript SDK in particular her....
Hi there!
If you need more help you can view your support options (expected response time for a 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!