Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
I making MVC application and trying to refresh token.
const string redirectUrl = "https://www.dropbox.com/1/oauth2/redirect_receiver";
// string oauthUrl = $@"https://www.dropbox.com/1/oauth2/authorize?response_type=token&redirect_uri={redirectUrl}&client_id={AppKey}";
string oauth2State;
oauth2State = Guid.NewGuid().ToString("N");
Uri authorizeUri = DropboxOAuth2Helper.GetAuthorizeUri(OAuthResponseType.Token, ApiKey, redirectUrl, state: oauth2State);
OAuth2Response tokenResult = await DropboxOAuth2Helper.ProcessCodeFlowAsync(authorizeUri, ApiKey, ApiSecret,null,oauth2State);
End getting error: The responseUri is missing a code value in the query component
@Tomtit, Would be much easier if you start with some simple test code (something like shown here). 🙂 Once you got it running, you can play with different code modifications there.
It's more automated when redirect URI points to local address rather external one for standalone local application. In referred example such URI is calculated here and is "extended" from local host (defined little above). The same URI (i.e. http://127.0.0.1:52475/authorize for particular example) should be registered for your application to be acceptable for Dropbox (security measure). As you can see in the example, authorizeURI (generated here) is used for launching your system browser rather than processing with API further (i.e. it's web address, not a API call or parameter of such call). In your post you are trying incorrect processing in the same context! The result from link confirmation (made by hand) gets received as a result of redirect handling (in the particular example in 2 steps - in HandleOAuth2Redirect and HandleJSRedirect functions bodies). 😉
Hope this gives direction.
@Tomtit Like Здравко said, I also recommend starting with an unmodified sample app to see that working first, before making changes or implementing your own.
Anyway, as they pointed out, your code that you shared here is incorrect because it is passing the authorization URL itself to ProcessCodeFlowAsync. That won't work because the authorization URI is the location of the web page where the user needs to manually authorize the app once. It's the resulting redirect URI (containing the authorization code) that you should pass to the responseUri parameter of ProcessCodeFlowAsync, like I described in your other thread. (Alternatively, you can pass just the authorization code string as the 'code' parameter.)
The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.
Sound good? Let's get started.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 Twitter or Facebook.
For more info on available support options, see this article.
If you found the answer to your question, please 'like' the post to say thanks to the user!