Ruby on rails Google OAuth本地重定向URI

Ruby on rails Google OAuth本地重定向URI,ruby-on-rails,oauth,devise,Ruby On Rails,Oauth,Devise,我发现了一些与此类似的主题*,但没有一个是目前适合我的答案 我已经使用/etc/hosts设置了本地rails服务器,并将以下条目添加到我的Google redirect URI列表中: zen.example.com zen.example.com/users/auth/google_oauth2/callback *.example.com/* 这是使用Desive+omniauth和GoogleOAuth2策略。现在,我已经完成了这项工作,下面是我的oauth链接,它将我带到这里: ht

我发现了一些与此类似的主题*,但没有一个是目前适合我的答案

我已经使用/etc/hosts设置了本地rails服务器,并将以下条目添加到我的Google redirect URI列表中:

zen.example.com
zen.example.com/users/auth/google_oauth2/callback
*.example.com/*
这是使用Desive+omniauth和GoogleOAuth2策略。现在,我已经完成了这项工作,下面是我的oauth链接,它将我带到这里:

https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=596705606035.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Fzen.example.com%2Fusers%2Fauth%2Fgoogle_oauth2%2Fcallback&state=ba07e128aea49aeb2443711336d5af6cc711a341f609a48a&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcalendar&access_type=offline&approval_prompt=force
我最终从谷歌那里得到了以下错误:

Error: redirect_uri_mismatch
The redirect URI in the request: http://zen.example.com/users/auth/google_oauth2/callback did not match a registered redirect URI
参考:
*

最终通过以下方式解决了此问题:

1使用旧的google控制台创建新的客户端密钥


2确保它使用的是http而不是https签出!在这种情况下,它总是对我有帮助。

与主要的google oauth相比,它有什么不同?它是一个更新的、更好的版本,可以在与更新的rubies(如Rails 4)交互时提供帮助。