andersongraciano / google-oauth-java-client

Automatically exported from code.google.com/p/google-oauth-java-client
0 stars 0 forks source link

User authorization failed (redirect_uri_mismatch) #94

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Version of google-oauth-java-client current from HEAD as of May 20, 2014

Java environment (e.g. Java 6, Android 2.3, App Engine)?
Java 7 - Command Line, Using DailyMotion Sample

Describe the problem.

- I followed the steps detailed here to setup the DailyMotion sample:
http://samples.google-oauth-java-client.googlecode.com/hg/dailymotion-cmdline-sa
mple/instructions.html

- I setup a dev account with Daily Motion, and created an API Key, changed the 
config in my local OAuth2ClientCredentials.java file, compiled and ran like so:

$ mvn -q exec:java

I expected the app to work, but it fails on the callback:

2014-05-20 16:27:14.072:INFO::Logging to STDERR via org.mortbay.log.StdErrLog
2014-05-20 16:27:14.073:INFO::jetty-6.1.26
2014-05-20 16:27:14.092:INFO::Started SocketConnector@127.0.0.1:8080
Please open the following address in your browser:
  https://api.dailymotion.com/oauth/authorize?client_id=cd2b090a4b05b2a7014a&redirect_uri=http://127.0.0.1:8080/Callback&response_type=code&scope=read
2014-05-20 16:27:14.193 java[38381:f07] ApplePersistence=NO
Attempting to open that address in the default browser now...
2014-05-20 16:27:15.308:INFO::Stopped SocketConnector@127.0.0.1:8080
User authorization failed (redirect_uri_mismatch)

NOTE: The url that flashes in the browser when it tries to run this is like so:
http://127.0.0.1:8080/Callback?error=redirect_uri_mismatch&error_description=Thi
s+%60redirect_uri%27+isn%27t+allowed+by+%60client_id%27+configuration.

Note that the message in the "error_description" is "This redirect uri isnt 
allowed by client_id configuration". So it seems that DailyMotion doesn't allow 
these types of redirects anymore?

How would you expect it to be fixed?
Change the sample so it works without localhost? I tried using ngrok.com to do 
an SSH tunnel to expose my localhost to DailyMotion, but this didn't work 
either.

Original issue reported on code.google.com by bradpa...@gmail.com on 20 May 2014 at 7:36

GoogleCodeExporter commented 9 years ago
After playing around with this a bit, I found the problem. The docs at this 
page:

http://samples.google-oauth-java-client.googlecode.com/hg/dailymotion-cmdline-sa
mple/instructions.html

say :

  specify "http://127.0.0.1:8080" as the "Callback URL".

when in fact the callback url should be the following in the Daily Motion API 
Config:

  http://127.0.0.1:8080/Callback

Changing the callback url to this fixed the problem, and the sample now runs 
fine.

PS: I'm sure it doesn't matter, but here are the 2 values from my Daily Motion 
API Config that were custom for this app:

Application Website:http://127.0.0.1:8080
Callback URL: http://127.0.0.1:8080/Callback

Thanks!

Original comment by bradpa...@gmail.com on 21 May 2014 at 12:53

GoogleCodeExporter commented 9 years ago
I've updated the instructions according to your findings. Thanks.

Original comment by wonder...@google.com on 9 Jul 2014 at 4:52