We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
IQCloud
6 years agoExplorer | Level 3
DropBox API: uploading a file issue
Hello, I first get the token from: https://api.dropbox.com/1/oauth2/authorize?response_type=code&client_id=xxxxxxxxxxx&redirect_uri=https://localhost:44332/Test following...
Greg-DB
Dropbox Community Moderator
6 years agoIn your /oauth2/authorize URL, I see that you're using the 'response_type=code' flow, which means you're using the OAuth 2 "code flow". In this flow, the code that you get back from that page is an "authorization code", not an "access token". When using the code flow, you need to then exchange the authorization code for an access token by calling /oauth2/token. The /oauth2/token response will contain the access token that you can then use to make actual API calls. (Attempting to use an authorization code in place of an access token to attempt to make actual API calls will result in an 'invalid_access_token' error.) You can find more information on how the OAuth flow works in the OAuth Guide, as well as the authorization documentation.
And if you're using the official Dropbox .NET SDK anyway, you should use the OAuth helpers it provides, as that will do much of the work for you. The documentation includes examples of how to use those in different contexts, resulting in an access token. There's also a sample web app that implements the OAuth flow as an example.
Also, note that per the documentation, the app authorization page should be accessed at https://www.dropbox.com/oauth2/authorize , not on api.dropbox.com as you have in your post.
About 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!