gpt4 book ai didi

python - Google OAuth2 redirect_uri_mismatch 问题

转载 作者:太空狗 更新时间:2023-10-30 00:02:54 35 4
gpt4 key购买 nike

全部,

我在尝试通过 google 进行身份验证时收到 400 redirect_url_mismatch 错误。我通过 django 应用程序使用 python-socal-auth 来实现这个过程。

一切顺利,直到我进入流程的最后阶段,我遇到了 redirect_uri_mismatch 问题。

在谷歌上,我收到了这条消息。

“请求中的重定向 URI:http://localhost:8000/something/complete/google-oauth2/与注册的重定向 URI 不匹配”

`Request Details
from_login=1
scope=https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile
response_type=code
redirect_uri=http://localhost:8000/something/complete/google-oauth2/
state=qT1RLLMa72F8NxFFubHwCVe3GgLDNcgZ
as=-55f896f3314b21af
pli=1
client_id=160177117398
authuser=0
hl=en`

下面是客户端 ID 的重定向 URI 的屏幕截图。

enter image description here

我做错了什么?

谢谢!

最佳答案

这里要注意的一件事是重定向 url 应该完全相同,直到最后一个尾部斜杠。就我而言,就像 http://localhot:8000/something/complete/google-oauth2这应该是
http://localhot:8000/something/complete/google-oauth2/这导致了 redirect_uri_mismatch。

还要在控制台中为重定向 url 定义 http: 和 https:,因为无论服务器中的 ssl 设置如何,社交身份验证生成的重定向 url 仍会发送 http。

关于python - Google OAuth2 redirect_uri_mismatch 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23313674/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com