【发布时间】:2019-06-19 10:51:13
【问题描述】:
我已经使用django allauth 集成了谷歌登录。
对于我的本地人来说,它工作正常。
但对于生产 url,它不起作用。
对于生产,它重定向到
localhost:8054/accounts/google/login/callback/?state=U0Y1kkth3jNB&code=4%2FbQFuzMf9I-RTXYJUJ-IhUyx36O-gAV00qFvtQHl3nNHzP_QVDJCfe-5f4a1zR12t_P8PgizD-cc95Hhk497fRyY&scope=profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile
预期:
mysite.com/accounts/google/login/callback/?state=U0Y1kkth3jNB&code=4%2FbQFuzMf9I-RTXYJUJ-IhUyx36O-gAV00qFvtQHl3nNHzP_QVDJCfe-5f4a1zR12t_P8PgizD-cc95Hhk497fRyY&scope=profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile
本地(工作):
in google api
Authorised redirect URIs = 127.0.0.1:8000/accounts/google/login/callback/
生产:
Authorised redirect URIs = mysite.com/accounts/google/login/callback/
【问题讨论】:
-
print(Site.objects.get(id=settings.SITE_ID).__dict__)的结果是什么?from django.conf import settings和from django.contrib.sites.models import Site
标签: django django-allauth google-developers-console