Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
GIS_questions
3 years agoExplorer | Level 4
Error when attempting to get an access token using refresh token
I keep encountering the same error when I attempt to use my refresh token, client id and client secret to get a new access token in my javascript code:
" Error in call to API function "files/upload...
Greg-DB
Dropbox Community Moderator
3 years agoIt looks like you're attempting to use a refresh token as a "Bearer" token in a few places in this case (where you set the "Authorization" header to "Bearer" + refreshToken). Refresh tokens themselves are not access tokens and cannot be used as Bearer tokens though, so please update your code to remove that. Refresh tokens should only be used as the "refresh_token" parameter value (as you do have) when calling /oauth2/token.
Also, I see in one line that you have a reference to "api.dropboxapi.com/oauth2/token_access_type=offline". That is not correct, and appears to be a combination of "api.dropboxapi.com/oauth2/token", which is the Dropbox OAuth 2 token endpoint, and "token_access_type=offline" which is only a parameter/option on www.dropbox.com/oauth2/authorize. You can find more information in the OAuth Guide and authorization documentation.
This comment with a basic example of the whole procedure may be a useful reference.
About Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.
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!