【发布时间】:2018-08-21 19:19:48
【问题描述】:
我尝试按照https://wsvincent.com/django-allauth-tutorial-custom-user-model/的教程进行操作
我授权的所需回调 URL 是
https://localhost:2053/accounts/google/login/callback/
在网站下,我填写如下
这就是表格的样子
snapweb=# select * from django_site
snapweb-# ;
id | domain | name
----+-----------+-------------
1 | 127.0.0.1 | example.com
(1 row)
我在settings.py中有以下代码
# DJANGO-ALLAUTH SETTINGS
# Site id required for using 'sites' framework with django-allauth
SITE_ID = 1 # 1 is for 127.0.0.1
ACCOUNT_DEFAULT_HTTP_PROTOCOL='https'
然后,我尝试通过点击以下链接登录 Google
<p><a href="{% provider_login_url 'google' %}">Log In with Gmail</a></p>
但是,我从 Google 收到以下错误
似乎django-allauth 传递了错误的重定向 URL 而没有正确的端口 (https://localhost/accounts/google/login/callback/)。
正确的网址应该是
https://localhost:2053/accounts/google/login/callback/
但是 django-allauth 正在过去
https://localhost/accounts/google/login/callback/
我可以知道如何将正确的重定向 URL 传递给 Google 吗?
我尝试了什么?
对于Site,我尝试过各种值,例如
snapweb=# select * from django_site
snapweb-# ;
id | domain | name
----+----------------+-------------
1 | 127.0.0.1:2053 | example.com
(1 row)
snapweb=# select * from django_site
snapweb-# ;
id | domain | name
----+----------------+-------------
1 | localhost:2053 | example.com
(1 row)
但是,谷歌仍然抱怨收到https://localhost/accounts/google/login/callback/
【问题讨论】:
标签: django django-allauth