Google OAuth 2 redirect_uri_mismatch - OmniAuth Rails应用 [英] Google OAuth 2 redirect_uri_mismatch - OmniAuth Rails app
本文介绍了Google OAuth 2 redirect_uri_mismatch - OmniAuth Rails应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用Rails应用验证Google帐户有问题。
我正在使用Devise的
重新启动服务器
I've a problem with authenticating Google account with my Rails app. I'm using omniauth-google-oauth2 gem with Devise. Always get this Error when I try to access google account:
Error: redirect_uri_mismatch
The redirect URI in the request: http://localhost:3000/users/auth/google_oauth2/callback did not match a registered redirect URI
I'm sure that the registered redirect URI in my google console app is right and identical with requested one, just like that:
so what's main the problem here?
解决方案
try this way :
add require "omniauth-google-oauth2" to devise.rb in config/initializers folder
add http://localhost:3000/users/auth/google_oauth2/callback
into Redirect URL in google API console https://console.developers.google.com
restart server
这篇关于Google OAuth 2 redirect_uri_mismatch - OmniAuth Rails应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文