We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
fmmmf
9 years agoExplorer | Level 3
DropboxOAuth2Helper GetAuthorizeUri removing port from redirecturl?
When using the DropboxOAuth2Helper.GetAuthorizeUri - we pass in the following params:
var response = DropboxOAuth2Helper.GetAuthorizeUri(OAuthResponseType.Code, ClientId, redirectUrl, state); ...
- 9 years ago
The Dropbox .NET SDK builds a Uri from the redirectUri string you provide, using the Uri Constructor. The Uri Class canonicalizes URIs, including:
"Removes default and empty port numbers."
The "443" port is default for SSL/TLS, so it's implied by "https://" and shouldn't be necessary.
Can you elaborate on the issues you're running in to with it omitted though?
Greg-DB
Dropbox Community Moderator
9 years agoThe Dropbox .NET SDK builds a Uri from the redirectUri string you provide, using the Uri Constructor. The Uri Class canonicalizes URIs, including:
"Removes default and empty port numbers."
The "443" port is default for SSL/TLS, so it's implied by "https://" and shouldn't be necessary.
Can you elaborate on the issues you're running in to with it omitted though?
fmmmf
9 years agoExplorer | Level 3
Hi Greg, thanks for the reply!
Since the GetAuthorizeUri method seemed to be removing the 443 it was a mismatch between the redirect url sent in there and the one we were sending into the ProcessCodeFlowAsync method - although to us, the url we were sending into both of them was the same. Once we also removed the 443 from the PCFA method, we were able to authenticate with dropbox.
The removal of the default port was not inherently obvious in these docs when we went looking for what was happening: https://dropbox.github.io/dropbox-sdk-dotnet/html/M_Dropbox_Api_DropboxOAuth2Helper_GetAuthorizeUri.htm
- fmmmf9 years agoExplorer | Level 3I should specify that the error we were getting was:
An unhandled exception has occurred: invalid_grant (1fff7674)
Dropbox.Api.OAuth2Exception: invalid_grant
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!