zquestz / omniauth-google-oauth2

Oauth2 strategy for Google
1.45k stars 413 forks source link

not working collback with params #442

Closed saviokmua closed 4 months ago

saviokmua commented 1 year ago

On Google console credentials I added the next Authorized redirect URIs:

1) http://localhost:3000/users/auth/google_oauth2/callback?kind=sign_in 2) http://localhost:3000/users/auth/google_oauth2/callback?kind=sign_up 3) http://localhost:3000/users/auth/google_oauth2/callback

when I used http://localhost:3000/users/auth/google_oauth2/callback all works ok!

but when I tried to use callback http://localhost:3000/users/auth/google_oauth2/callback?kind=sign_in I received the next issue:

D, [2023-04-11T09:03:21.241145 #21150] DEBUG -- omniauth: (google_oauth2) Callback phase initiated.
E, [2023-04-11T09:03:21.419771 #21150] ERROR -- omniauth: (google_oauth2) Authentication failure! invalid_credentials: OAuth2::Error, redirect_uri_mismatch: Bad Request
{
  "error": "redirect_uri_mismatch",
  "error_description": "Bad Request"
}

could you help please, what I'm doing wrong?

 omniauth-google-oauth2 (1.1.1)
 omniauth-oauth2 (1.8.0)
 omniauth (2.1.1)
zquestz commented 1 year ago

Seems they don't like custom parameters in the url. Perhaps you can pass that data in the state param?