在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。


当前回答

没有“一个”解决方案,这似乎很奇怪,也很烦人。 对我来说,http://localhost:8000没有成功,但http://localhost:8000/成功了。

其他回答

对于我的web应用程序,我纠正了我的错误

instead of : http://localhost:11472/authorize/
type :      http://localhost/authorize/

小心url末尾多余的/ http://localhost:8000和http://localhost:8000/不同

我在控制台中有两个请求uri, http://xxxxx/client/api/spreadsheet/authredirect和http://localhost。

我尝试了这个问题的所有回答,并确认没有一个是我的问题。

我从控制台删除了localhost,更新了client_secret。Json在我的项目中,不匹配错误消失了。

没有“一个”解决方案,这似乎很奇怪,也很烦人。 对我来说,http://localhost:8000没有成功,但http://localhost:8000/成功了。

在我的例子中,redirect-uri是http://127.0.0.1:5000/auth/google/callback 我一直在http://localhost:5000/auth/google上请求 确保您使用的是localhost还是127.0.0.1。