Why google authentication works well in development & staging modes but does not work in production?

68 Views Asked by At

I've got a problem with configuring google authentication in my ruby on rails application using devise and omniauth-google-oauth2.

After carefully following instructions from omniauth-google-oauth2 github readme I've added Authorized redirect URIs to settings list:

https://<production_domain>/users/auth/google_oauth2/callback https://<staging_subdomain>/users/auth/google_oauth2/callback http://localhost:3000/users/auth/google_oauth2/callback

The issue is that authorization works well in development and staging environments, but does not work in production mode.

Trying to authenticate in production I'm getting:

Error 400: redirect_uri_mismatch

Request details redirect_uri=https://<production_domain>/users/auth/google_oauth2/callback

it seems very strange to me cause mentioned callback is present in my Authorized redirect URIs to settings list.

Help me please to set up authentication in production evironment. Fell free to ask me about any additional information. Thank you in advance!

0

There are 0 best solutions below