You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

CTO1's avatar
CTO1
Explorer | Level 3
3 years ago

responseUri C# problem

I am trying to set my dropbox configuration to TokenAccessType Offline on my page, but I am getting erros on the "DropboxOAuth2Helper.ProcessCodeFlowAsync" I get: Dropbox.Api.OAuth2Exception: 'inva...
  • Greg-DB's avatar
    3 years ago

    The "redirect_uri mismatch" error indicates that this call failed because the redirect_uri used on /oauth2/authorize, which is the redirectUri parameter on GetAuthorizeUri in the .NET SDK, to get that authorization code does not match the redirect_uri used when calling /oauth2/token, which is the redirectUri parameter on ProcessCodeFlowAsync in the .NET SDK. These two values need to match exactly. Or, if you didn't set the redirectUri parameter on GetAuthorizeUri you should likewise omit it when calling ProcessCodeFlowAsync as well.

     

    You didn't show your GetAuthorizeUri, but for your ProcessCodeFlowAsync call you seem to be manually constructing your responseUri from your redirectUri value, which isn't the intended way to do this. The responseUri value should be the redirected URI, containing the code, as triggered on your app by Dropbox redirecting the user back to your app after they authorized it. Dropbox would do so if you set the redirectUri parameter on GetAuthorizeUri.

     

    So, if you are not actually using a redirect URI by setting the redirectUri parameter on GetAuthorizeUri to have the user automatically redirected, you should also not set the redirectUri parameter on ProcessCodeFlowAsync. In that case, you can instead use the form of ProcessCodeFlowAsync that takes the "code" parameter directly instead of the "responseUri" parameter.

     

    Alternatively, if you do want to use a redirect URI, make sure you set it using the redirectUri parameter on GetAuthorizeUri and then pass the same redirectUri parameter to ProcessCodeFlowAsync.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,915 PostsLatest Activity: 7 hours ago
333 Following

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!