authentication - Google OAuth 2 授权 - 错误 : redirect_uri_mismatch

标签 authentication oauth-2.0 google-signin

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

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

此消息是什么意思?我该如何解决它? 我使用 gem omniauth-google-oauth2

最佳答案

重定向 URI(返回响应的位置)必须在 API 控制台中注册,错误表明您没有这样做,或者没有正确完成。

转到您的项目的控制台并在“API 访问”下查看。您应该在那里看到您的客户端 ID客户端 key ,以及重定向 URI 列表。如果所需的 URI 未列出,请单击“编辑设置”并将 URI 添加到列表中。

编辑:(来自下面评价很高的评论)请注意,更新 google api 控制台以及当前的更改可能需要一些时间。一般只有几分钟,但有时看起来更长。

关于authentication - Google OAuth 2 授权 - 错误 : redirect_uri_mismatch,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11485271/

相关文章:

oauth-2.0 - 如何在不和谐时从 oauth 获取用户 ID

php - 谷歌日历预订系统

java - com.android.build.transform.api.TransformException

mysql - 如何让 ASP.NET 角色使用 MySQL?

jsp - Joomla 2.5 自定义身份验证插件,通过外部 jsp 网站进行身份验证

linux - 具有 kerberos 身份验证的 Kafka 控制台消费者

oauth-2.0 - Salesforce 动态 OAuth 2.0 回调 uri

javascript - Google 从本地主机登录中的 idpiframe_initialization_failed

swift - 如何实现 GoogleSignIn

c# - 不记名 token 无效