We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
SimonFan
9 years agoExplorer | Level 3
Problem to get the auth code
Hi All: I have a problem when I was trying to get the auth code. I am using WPF and tring to get the "auth-code-input" from the webpage that dropbox direct to. But the when I was using the following code it alway get null. For now, I set the redirct_uri to empty, does this matter?
mshtml.IHTMLDocument3 doc3 = WebBrowserAuth.Document as mshtml.IHTMLDocument3;
var myHtmlElement = doc3.getElementById("auth-code-input");
string strAuthCode = myHtmlElement.getAttribute("value");
Many thanks in advance!
3 Replies
- Greg-DB9 years ago
Dropbox Community Moderator
[Cross-linking for reference: https://stackoverflow.com/questions/44961671/dropbox-api-get-the-auth-code-issue ]
I'm not sure I understand your question, but it sounds like you may be trying to query the authorization code out of the HTML of the page after the user authorizes your app on /oauth2/authorize.
You shouldn't try to retrieve the authorization code that way, as that page is subject to change. If you want to get the authorization code programmatically, you should instead supply a redirect URI and get it from the URL parameter itself. You can find more information on how this works here:
https://www.dropbox.com/developers/documentation/http/documentation#oauth2-authorize - SimonFan9 years agoExplorer | Level 3Hi Greg: Thank you for your reply. I am working on desktop software with WPF so I don't have redirect URI, can I set redirect URI to https://localhost ?
- Greg-DB9 years ago
Dropbox Community Moderator
Yes, localhost redirect URIs like this are allowed.
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!