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
Jaihoon_Ahn
8 years agoExplorer | Level 3
How do I set the Redirect URI port number?
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&client_id=4tb5otn53umkiro&state=W1LlGGzWZXqpv68QU-d3wrGbOFviArFeVyvdXQBX7u4";
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?
- Greg-DBDropbox Staff
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.
- Jaihoon_AhnExplorer | Level 3
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.- Greg-DBDropbox StaffYou can choose whatever redirect URI/port you want, but whatever you do choose, you need to pre-register it on the App Console.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,882 PostsLatest Activity: 3 years agoIf 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!