在https://code.google.com/apis/console网站上,我已经注册了我的应用程序,设置生成的客户端ID:和客户端秘密到我的应用程序,并尝试登录谷歌。 不幸的是,我收到了错误信息:

Error: redirect_uri_mismatch
The redirect URI in the request: http://127.0.0.1:3000/auth/google_oauth2/callback did not match a registered redirect URI

scope=https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email
response_type=code
redirect_uri=http://127.0.0.1:3000/auth/google_oauth2/callback
access_type=offline
approval_prompt=force
client_id=generated_id

这条信息是什么意思,我该如何修复它? 我使用宝石omniauth-google-oauth2。


当前回答

在我的例子中,重置secret ('reset secret'-按钮)就成功了。

其他回答

任何人努力寻找在新的控制台设置重定向url: api和认证->凭据-> OAuth 2.0客户端id ->单击链接找到所有的重定向url

要使它在本地主机上工作,如果使用web服务器,请提供

Authorized JavaScript origins (Client ID for web appication)
e.g. http://localhost:4200

以上的方法对我来说都没用。下面是

更改授权重定向url到- https://localhost:44377/signin-google

希望这能帮助到一些人。

2015年7月15日-上周在登录时使用这个脚本工作的登录

<script src="https://apis.google.com/js/platform.js" async defer></script>

停止工作并开始导致Error 400 with Error: redirect_uri_mismatch

然后在DETAILS部分:redirect_uri=storagerelay://…

我把它改成:

<script src="https://apis.google.com/js/client:platform.js?onload=startApp"></script>

对我来说,这是因为在“授权重定向uri”列表中,我错误地把https://developers.google.com/oauthplayground/而不是https://developers.google.com/oauthplayground(没有/在最后)。