0

I setup my credentials for using google oauth2 as a method of signing up. Works fine locally, but when I try and signup on the staging site I get a "redirect_uri_mismatch" error. Even after I copy and paste the url its complaining about into the redirect uris section. I am at my wits end and have almost thrown my laptop across the room several times. Help would be appreciated since google support is non-existent.

user3134291
  • 1
  • 1
  • 1
  • what is the uri? maybe google has no access to it? maybe something like localhost? – OhadR Dec 25 '13 at 10:28
  • http://stackoverflow.com/questions/11485271/google-oauth-2-authorization-error-redirect-uri-mismatch – OhadR Dec 25 '13 at 10:31

4 Answers4

1

Double check on the google console. On the cloud console under APIs & Auth -> Credentials, click the Create New Client ID red button. Make one for a web application. You may have to come back and edit it in order to get the redirect/callback uri set up correctly.

lumpynose
  • 967
  • 4
  • 12
0

Have you tried dropping the port?

http://example.com/users/auth/google_oauth2/callback

I had the same issue using http://localhost:9000 ...

Robert
  • 5,278
  • 43
  • 65
  • 115
0

If nothing works and no redirect_uri was provided when initiating the Google client, try using postmessage in the redirect_uri field.

-1

I code rails, and I have to change the Oauth2 redirect uri in the google console, as well as my own code:

In development:

OAUTH2_REDIRECT: http://local.domain:3000/users/auth/google_oauth2/callback

In production:

OAUTH2_REDIRECT: http://example.com:3000/users/auth/google_oauth2/callback

I've learned The Hard Way to make sure these config vars are right everywhere.

Paul Dacus
  • 486
  • 2
  • 9