The URL's seem right (Last updated them yesterday):
The files too:
omniauth.rb:
provider :google_oauth2, 'MY_CLIENT_ID.apps.googleusercontent.com', 'MY_CLIENT_SECRET',
:scope => 'https://mail.google.com/mail/feed/atom/'
Error: redirect_uri_mismatch
The redirect URI in the request: http://localhost:3000/auth/google_oauth2/callback did not match a registered redirect URI
header.html.erb
<li><%= link_to "Sign in with Google", "auth/google_oauth2" %></li>
routes.rb:
match '/auth/:provider/callback', to: 'sessions#omniauth_create'
But I'm getting this:
> Error: redirect_uri_mismatch The redirect URI in the request:
> http://localhost:3000/auth/google_oauth2/callback did not match a
> registered redirect URI
(Twitter and Facebook OmniAuth are working perfectly)
Not sure what is the problem. Any usggestions to fix this?
EDIT
I changed the URI to http
...:
But still getting the same error.
This error typically means the Client Redirect URL was not properly added to the OAuth Web Application in the Google Cloud Console. To resolve this, the user will need to copy the Client Redirect URL from the Single Sign-On Settings page from ThinkCentral, my.hrw.com, or HMH Ed.
When a user tries to login after the session id is expired, the system throws the OAuth error. Solution: Typically, clearing the browser or device cache fixes the problem.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With