谷歌OAuth2重定向URI不匹配问题

8

大家好,

我在尝试通过谷歌进行身份验证时遇到了400 redirect_url_mismatch错误。我使用python-social-auth来实现这个过程,并将其应用于django应用程序。

一切都很顺利,直到我到达流程的最后阶段,我遇到了一个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
我做错了什么吗?
谢谢!
2个回答

4

3

请确保在urls.py文件中添加了social-auth

url('', include('social.apps.django_app.urls', namespace='social')),

在console.developers.google.com上将授权重定向URI设置为http://localhost:8000/something/complete/google-oauth2/


谢谢,google-oauth2/上的最后一个是我漏掉的部分。 - Mark Filley

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接