Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
Dropbox You have configured a Redirect URI for OAuth2 authentication.
- http://127.0.0.1
- http://127.0.0.1:port
I have coded the following code in C #.
----------------------------------------------------------
string redirectURI = "http://127.0.0.1:56207";
string requestURI = "https://www.dropbox.com/oauth2/authorize?response_type=token&redirect_uri=http://127.0.0.1:56207&cli...";
HttpListener httpListener = new HttpListener();
httpListener.Prefixes.Add("http://127.0.0.1:56207/");
httpListener.Start();
System.Diagnostics.Process.Start(requestURI);
----------------------------------------------------------
The result is Error (400).
What is wrong with it?
You can use an OAuth 2 redirect URI including a port number, but it will still need to exactly match one of the OAuth 2 redirect URIs that you previously registered, including the port and path. If they don't match exactly, you'll get the error above.
So, first register the exact OAuth 2 redirect URI on the App Console (using the port number, not the string "port") and then use that exact string in the redirect_uri URL parameter.
For example, you're passing "http://127.0.0.1:56207" as the redirect_uri value, so you'll need to register "http://127.0.0.1:56207" exactly on the App Console.
I just tried this and it is working properly for me. If it's not working for you, please share a screenshot of the OAuth 2 redirect URIs registered for your app on the App Console as well as a screenshot of the error page you're getting, including the full URL.
Answer Well received.
When the fixed port number is used according to the reply contents, it works correctly.
Fixing the port number is probably a problem.
You specified port 56207 in the app console as 'http://127.0.0.1:56207'.
OAuth2 authentication is expected to fail if the 56207 port is blocked on the PC or another application is preempting it.
So, when redirecting to Localhost, I want to specify port number which is not used in PC.
I know that 'Google' is not limited to Localhost.
Additional questions.
Let's try randomly selecting the port number from "50000 ~ 51000".
AppConsole settings should add 1000 or more as below.
http://127.0.0.1:50000
http://127.0.0.1:50001
http://127.0.0.1:50002
http://127.0.0.1:50003
... more ... more ...
http://127.0.0.1:50998
http://127.0.0.1:50999
http://127.0.0.1:51000
Is there a limit to the number of Redirect URIs that can be set in AppConsole?
yes, fixed port number is really a headache.
And you are right about Google. For some reason Dropbox limits their redirect URIs when Google allows to define that URI dynamically.
Instead of letting my web server find out which port is available I have to loop over fixed number of ports and try to run that server using first avaialble port. It is really uncomfortable.
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!