0

I use rails 4.2.5, tryed omniauth-gplus and omniauth-google-oauth2 lastest versions gems and got the same issue

omniauth.error"=>#<OAuth2::Error: redirect_uri_mismatch: 
{ "error" : "redirect_uri_mismatch" }>,  
"omniauth.error.type"=>:invalid_credentials,
"omniauth.error.strategy"=>#<OmniAuth::Strategies::GPlus>

In OmniauthCallbacksController I am getting in to :failure

(OAuth works good with other providers)

I already added require "omniauth-google-oauth2" in device.rb like in Google OAuth 2 redirect_uri_mismatch - OmniAuth Rails app

Actually I`m trying with same settings.

I think failure is in my console.developers.google.com settings. Now I do not know what else combination of Authorized JavaScript origins and Authorized redirect URIs to try. (I tried it with and without last '/', on localhost, localhost alias(with and without port) or heroku)

Can you say me, what settings are exactly right for google+ api for http://localhost:3000?

Or maybe I`v missed out something? Thank you.

BhushanK
  • 1,205
  • 6
  • 23
  • 39
Mike Belyakov
  • 1,355
  • 1
  • 13
  • 24

1 Answers1

0

I suggest you try

http://127.0.0.1:3000

Personally, when I work with oauth redirects I like to use thin

$ gem install 'thin'

$ thin start --ssl

Then I set the redirect uri to

https://127.0.0.1:3000

This way, there won't be a protocol mismatch and will let you keep the session alive between the requests

Laurens
  • 2,420
  • 22
  • 39