Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redirect_uri_mismatch #15

Open
leventyalcin opened this issue Sep 24, 2014 · 3 comments
Open

redirect_uri_mismatch #15

leventyalcin opened this issue Sep 24, 2014 · 3 comments

Comments

@leventyalcin
Copy link

Hi,

I tried everything i can do but no luck. Only I can see error above.

Error: redirect_uri_mismatch

The redirect URI in the request: http://redmine.domain.com/oauth2callback did not match a registered redirect URI.

Learn more

Request Details
from_login=1
response_type=code
scope=https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile
redirect_uri=http://redmine.domain.com/oauth2callback
as=-9c076da2e673a8
client_id=910957160597-mu1o3prbc01v9sf2tg4nc8livv450jdk.apps.googleusercontent.com
hl=en-US

I'm sure it is not HTTP:// at Google Developer Console http://prntscr.com/4ptsql

Processing by RedmineOauthController#oauth_google as HTML
  Parameters: {"back_url"=>"https://redmine.domain.com/"}
  Current user: anonymous
Redirected to https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=910957160597-mu1o3prbc01v9sf2tg4nc8livv450jdk.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Fredmine.domain.com%2Foauth2callback&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile
Completed 302 Found in 9.1ms (ActiveRecord: 0.3ms)

ignore domain.com i changed it

@leventyalcin
Copy link
Author

When I force to HTTPS I started to get error below;

Error: invalid_client

no application name

Request Details
scope=https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile
response_type=code
redirect_uri=https://redmine.domain.com/oauth2callback
client_id=910957160597-mu1o3prbc01v9sf2tg4nc8livv450jdk.apps.googleuserconte

Changes I've made

# diff redmine_omniauth_google/app/controllers/redmine_oauth_controller.rb /tmp/redmine_oauth_controller.rb
10c10
<       redirect_to oauth_client.auth_code.authorize_url(:redirect_uri => 'https://redmine.domain.com/oauth2callback', :scope => scopes)
---
>       redirect_to oauth_client.auth_code.authorize_url(:redirect_uri => oauth_google_callback_url, :scope => scopes)
21c21
<       token = oauth_client.auth_code.get_token(params[:code], :redirect_uri => 'https://redmine.domain.com/oauth2callback')
---
>       token = oauth_client.auth_code.get_token(params[:code], :redirect_uri => oauth_google_callback_url)

@leventyalcin
Copy link
Author

Stopped thin and started webrick with SSL support and URLs changed to HTTPs but still no luck

Error: invalid_client

no application name
Request Details

    scope=https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile
    response_type=code
    redirect_uri=https://redmine.domain.com/oauth2callback
    client_id=910957160597-8u7iqo3pa10p3i6i54ls74daut8jg3f0.apps.googleusercontent.com

That’s all we know.

And stil I'm sure Google Apps configuration is OK. http://prntscr.com/4pwicg

@leventyalcin
Copy link
Author

So, Found what is wrong at here http://stackoverflow.com/a/18951654/953706 and it works now.

I just still no idea why it sets protocol from server insted of requests. It works like SSL Requests -> Nginx -> SSL Requests -> Webrick (thin etc). dunno. Maybe I'm missing something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant