Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Invalid client #20

Closed
afrankel opened this Issue · 7 comments

5 participants

@afrankel

Sorry, but I seem to be missing something obvious here. I'm a newbie.

I have the following config (using devise, omniauth):

config.omniauth :google_oauth2, "[my key]", "[secret]", {access_type: 'online', approval_prompt: ''}

[my key] above also happens to equal [my domain]

I get 400 Bad Request:

Error: invalid_client
Request Details
response_type=code
scope=https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile
redirect_uri=https://[my domain]/users/auth/google_oauth2/callback
access_type=online
client_id=[my domain]

I think it has to do with one of a few possibilities:
1) I have ssl on my app and I'm wondering if I need to pass additional parms.

2) I am not using the right key/secret. I have found 3 places on google (apps) to set up oauth keys:
a) https://accounts.google.com/ManageDomains - where I have it set up and I'm using this key/secret
b) https://code.google.com/apis/console - where I have it set up but I'm NOT using this key/secret
c) https://www.google.com/a/cpanel/[mydomain]/SetupOAuth - I am NOT using this one.

What am I missing?

Thanks in advance.

@zquestz
Owner

I think your just using the wrong key/secret. You want to use the key/secret from https://code.google.com/apis/console

@afrankel

Yes! That was it.

For others who stumble upon this issue the other thing I had wrong was the redirect URL I registered with google. Ours is:
http://localhost:3000/users/auth/google_oauth2/callback - not the default that google had. You will get a redirect issue if you don't set it correctly.

Works great! Even the no-reauth parameter works as I want it.

Thank you much.

@afrankel afrankel closed this
@zquestz
Owner

Glad you figured it out. =)

@reflectdev

https://accounts.google.com/ManageDomains -> for OAuth
https://code.google.com/apis/console -> OAuth2 (This is the right one for YouTube Oauth 2)
https://www.google.com/a/cpanel/[mydomain]/SetupOAuth -> Service to Your Google App admin, i.e. Gmail, Calendar, etc.

You can curl https://gdata.youtube.com/feeds/api/users/default -H 'Authorization: OAuth ya29.reset of the Key'

@furiabhavesh

I have wasted almost a week on this, still unable to make it work :( Heres what all I have setup.

devise.rb

config.omniauth :google_oauth2, 'CLIENT_ID', 'KEY', { access_type: "offline", approval_prompt: "" }

routes.rb

devise_for :users, :controllers => {:omniauth_callbacks => "users/omniauth_callbacks"}

Enabled Contact and Google+ API on Google Developer Console.
Redirect URIs : http://localhost:3000/
Javascript Origins : http://localhost:3000/
I have tried http and https combinations, re-generated keys and renamed project tons of time and waited for more than 10 mins. after changes, still I am getting "Err 400 : redirect_uri_mismatch" error saying that :

The redirect URI in the request: https://localhost:3000/users/auth/google_oauth2/callback did not match a registered redirect URI

Can anyone help in making it work ?

@furiabhavesh

It worked finally when I changed the Redirect URI to the full callback URL as follows:

http://localhost:3000/users/auth/google_oauth2/callback

instead of mentioning only

 http://localhost:3000/
@noer180895

i have error, when i trying for login with google plus with this url

http://localhost:3000/auth/google_oauth2

but i get error such

No route matches [GET] "/auth/google_oauth2"

can anyone help in making it work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.