One month down in 2025: How are your resolutions coming along? Check out how to get back on track here.
Forum Discussion
chibuzor
6 years agoExplorer | Level 4
Dropbox Javascript SDK + Auth0 access token gives invalid_access_token error
Oh my, let me begin:
What I have working:
- Auth0 application created and connected to dropbox. The 'Try' option successfully gives me access to my app folder on a user's dropbox account. Great
- I have setup my Dropbox App on my dropbox developer site and it worked previously to create folders, upload files, and read from folders.
I changed my app from using a single access code (mine generated from my developer website), to authenticate users using Auth0.
The image below fails (using the Auth0 accessToken returned to create a new Dropbox client using the Dropbox Javascript SDK)
Using the accessToken returned from Auth0 after successfully authenticating a user and after the user grants my app access to their dropbox site, using the Auth0 accessToken
- to create a new instance of the Dropbox client (Dropbox SDK for Javascript) works
- to call filesCreateFolderV2() or any other api methods fail with an 'invalid_access_token' error
Please helppppppp.
We can't offer help with Auth0 itself, but we'll be happy to help with the Dropbox side of things.
An OAuth 2 access token for the Dropbox API should work the same way regardless of exactly where/how you get it (e.g., from the app's info page on Dropbox App Console, or from the actual Dropbox OAuth app authorization page), as long as it is in fact an access token received from Dropbox, and it hasn't been revoked.
Can you print out and inspect the "this.auth.accessToken" value to see what it is? (Don't post it here if it does look like an access token though.)
For instance, make sure that the Dropbox OAuth app authorization flow completed successfully and the resulting access token string was saved in that variable.
I see that you are setting "responseType" to "token id_token", but if that is the value used for the Dropbox /oauth2/authorize page, that should just be "token". Likewise, the Dropbox /oauth2/authorize page doesn't currently take "scope" or "domain" parameters.
- Greg-DB
Dropbox Staff
We can't offer help with Auth0 itself, but we'll be happy to help with the Dropbox side of things.
An OAuth 2 access token for the Dropbox API should work the same way regardless of exactly where/how you get it (e.g., from the app's info page on Dropbox App Console, or from the actual Dropbox OAuth app authorization page), as long as it is in fact an access token received from Dropbox, and it hasn't been revoked.
Can you print out and inspect the "this.auth.accessToken" value to see what it is? (Don't post it here if it does look like an access token though.)
For instance, make sure that the Dropbox OAuth app authorization flow completed successfully and the resulting access token string was saved in that variable.
I see that you are setting "responseType" to "token id_token", but if that is the value used for the Dropbox /oauth2/authorize page, that should just be "token". Likewise, the Dropbox /oauth2/authorize page doesn't currently take "scope" or "domain" parameters.
- chibuzorExplorer | Level 4
So I fixed my issue but not in the way I would expect.
I thought Auth0 and Dropbox were streamlined but the 'token' Auth0 returns after authenticating with dropbox is different from the 'code'/'token' that the Dropbox API returns after authenticating.
So to get it to work, I had to essentially follow all of the Dropbox API steps and ignore authenticating using the Auth0 Typescript SDK.
Thank you Greg for your help with this. This link helped a lot and started to make more sense after I had tried MANY different approaches: https://www.dropbox.com/developers/documentation/http/documentation#oauth2-authorize
Feel free to ping me if anyone on the forums need help authenticating with the Dropbox API. I might be able to share my usecase and help them through.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,941 PostsLatest Activity: 4 hours ago
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!