cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem to get the auth code

Problem to get the auth code

SimonFan
Explorer | Level 3

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 3

Greg-DB
Dropbox Staff
[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

SimonFan
Explorer | Level 3
Hi 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-DB
Dropbox Staff
Yes, localhost redirect URIs like this are allowed.
Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    SimonFan Explorer | Level 3
What do Dropbox user levels mean?