django-allauth谷歌回调URL不适用于生产

时间:2019-06-19 10:51:13

标签: django django-allauth google-developers-console

我已使用django allauth集成了Google登录名。

对于我的本地人来说,它工作正常。

但是对于生产网址,它不起作用。

对于生产,它重定向到

SELECT
        [System.Id],
        [System.WorkItemType],
        [System.Title],
        [System.State],
        [System.AreaPath],
        [System.IterationPath]
FROM workitems
WHERE
        [System.TeamProject] = @project
        and [System.IterationPath] LIKE '%MY ITERATION NAME%' 
ORDER BY [System.IterationPath] ASC

预期:

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/

1 个答案:

答案 0 :(得分:0)

我通过X-Forwarded-Host

解决了该问题

在settings.py

USE_X_FORWARDED_HOST = True