One month down in 2025: How are your resolutions coming along? Check out how to get back on track here.
Forum Discussion
JaideepSingh
8 years agoNew member | Level 2
API v2: Dropbox integration to website
I want to to sync user dropbox account with our website so that user can directly upload their documents from our site.I am using Dotnet and had done following code
string appkey = ConfigurationManager.AppSettings.Get("Appkey").ToString();
string appSecret = ConfigurationManager.AppSettings.Get("AppSecret").ToString();
string returnUrl = ConfigurationManager.AppSettings.Get("ReturnUrl").ToString();
var client = new DropboxClient(appkey, appSecret);
var a = client.AccessToken;
client.ReturnUrl = returnUrl;
client.RedirectToAuthorization();
It correctly redirect me to dropbox login form and after allowing permission it send back to redirect URl with parameters state and code in query string ,but when I try to use code as access token while uploading file it give error of invalid token.
Am I doing something wrong,is code that is return is not the access token,if not then how can i get the access token from it.Please remember that i am using asp.net c#
- Greg-DB
Dropbox Staff
If you're using the OAuth 2 "code" flow, the code returned on the redirect URI is an "authorization code", not an "access token". You'll need to exchange the authorization code for an access token. You can find more information on that in the documentation:
https://www.dropbox.com/developers/documentation/http/documentation#authorization
The OAuth guide may also be helpful:
https://www.dropbox.com/developers/reference/oauth-guide
By the way, based on your code it looks like you may not be using the official Dropbox API v2 .NET SDK. We highly recommend using it if possible:
https://github.com/dropbox/dropbox-sdk-dotnet
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,950 PostsLatest Activity: 2 days 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!