Google OAuth2 redirect_uri_mismatch问题

use*_*604 7 python django google-api

所有,

我试图通过谷歌进行身份验证时得到400 redirect_url_mismatch错误.我通过django应用程序使用python-socal-auth来实现这个过程.

一切顺利,直到我进入redirect_uri_mismatch问题的最后阶段.

在谷歌上,我收到此消息.

"The redirect URI in the request: http://localhost:8000/something/complete/google-oauth2/ did not match a registered redirect 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`
Run Code Online (Sandbox Code Playgroud)

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

在此输入图像描述

我究竟做错了什么?

谢谢!

vme*_*zes 3

确保您在 urls.py 中添加了 Social-auth 作为

url('', include('social.apps.django_app.urls', namespace='social')),
Run Code Online (Sandbox Code Playgroud)

并在 console.developers.google.com 上将其设置Authorized redirect URIshttp://localhost:8000/something/complete/google-oauth2/