The URL\'s seem right (Last updated them yesterday):
The files too:
<There's a relatively fresh issue with omniauth-oauth2
gem version 1.4
https://github.com/intridea/omniauth-oauth2/issues/81#issuecomment-151038559
Temporary fix is to downgrade that gem explicitly in the Gemfile
gem 'omniauth-oauth2', '~> 1.3.1'
It looks like the request is hitting http://localhost:3000/auth/google_oauth2/callback
, but your specified redirect URI matching the similar pattern is for https
. Adding http://localhost:3000/auth/google_oauth2/callback
to your list of redirects may potentially solve that issue.
EDIT: Another potential fix is including a trailing /
in the corresponding redirect URIs, which appeared to work in this case.
foo
vi config/initializers/omniauth.rb
OmniAuth.config.full_host = 'https://localhost:3000'
Rails.application.config.middleware.use OmniAuth::Builder do
provider :google_oauth2, 'google_client_id', 'google_client_secret'
end
I tried all of the above but didn't work for me. In the end noticed in my error message my call back was slightly different. I had a users between localhost:3000 and auth. Not really sure why.
http://localhost:3000/users/auth/google_oauth2/callback
Changed it, waited 30 mins and it worked.
Sharing a very simple copy-paste solution that worked for me.
I copied whatever I was specifying in my code as redirectUri
i.e. "redirect_uri": "http://127.0.0.1:3001/"
and pasted the value
of this key
inside the Google settings that ask for Authorized redirect URIs. This way I'm ensured that both the parameters are same.
If the url
was computed, I would console.log()
it and copy it from the console window before pasting it in for google settings.