我用Rails应用程序验证Google帐户时遇到问题。
我在Devise中使用omniauth-google-oauth2 gem。
当我尝试访问Google帐户时,始终会收到此错误:
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
我确定我的Google控制台应用程序中注册的重定向URI是正确的,并且与请求的重定向URI相同,如下所示:那么这里的主要问题是什么?
最佳答案
尝试这种方式:
add require "omniauth-google-oauth2" to devise.rb in config/initializers folder
add http://localhost:3000/users/auth/google_oauth2/callback
到Google API控制台https://console.developers.google.com中的重定向URL重新启动服务器
关于ruby-on-rails - Google OAuth 2 redirect_uri_mismatch-OmniAuth Rails应用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22515244/