Closed kyryloliinyk closed 1 year ago
This is generally because the configured app is configured incorrectly on the Google side. Check the settings for the app associated with your client_id and make sure it matches perfectly.
Thank you very much @zquestz ! It was just a mistype in credentials for production environment. Such a stupid mistake, unfortunately :(
I've got a problem with configuring google authentication in my Rails application using
devise
andomniauth-google-oauth2
.After carefully following Usage secrion instructions 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
My
config/initializers/omniauth.rb
looks like:THE ISSSUE IS that authorization works well in _development and staging_ environments, but does not work in production env.
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.
NOTES:
User
andAdmin
. In case of Admin with the same settings everything works well. This issue is related only toUser
model.User
and it works well with the simillar settings.