redirect_uri_mismatch. Login with Google using Ruby on Rails

吃可爱长大的小学妹 提交于 2019-12-18 09:44:47

问题


I'm trying to add Google Login to my app using omniauth-google-oauth2 gem.

I have created the client Id and secret in console.developers.google.com and added redirect_uri as follows.

routes.rb

get 'auth/:provider/callback', to: 'people#socialmedialogin',:as => :callback

Gemfile

gem 'omniauth-oauth2', '~> 1.4.0'
gem "omniauth-google-oauth2"

I am facing the problem in signing in. It is authenticating with Google and fails to redirect. Error is as follows.

redirect_uri_mismatch: { "error" : "redirect_uri_mismatch" }

Extracted source (around line #113):

  when 400..599
    error = Error.new(response)
    raise(error) if opts.fetch(:raise_errors, options[:raise_errors])
    response.error = error
    response
  else
    .....

回答1:


Try to downgrade the gem (could be compatibility problem) :

gem 'omniauth-oauth2', '~> 1.3.1'


来源:https://stackoverflow.com/questions/41463685/redirect-uri-mismatch-login-with-google-using-ruby-on-rails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!