我已经习惯在 Django 中的社交 AUTH 中使用 Google 提供程序,但提供程序未显示在 Django 模板中

问题描述 投票:0回答:1

社交应用

我正在尝试使用 django-allauth 在我的 Django 项目中设置 Google 身份验证,但 Google 登录选项没有出现在我的登录页面上。我用过这个代码:

INSTALLED_APPS = [
    'django.contrib.sites',
    'allauth',
    'allauth.account',
    'allauth.socialaccount',
    'allauth.socialaccount.providers.google',
   
]`

MIDDLEWARE = [
   'allauth.account.middleware.AccountMiddleware',
]
SITE_ID = 1
LOGIN_REDIRECT_URL='/'
SOCIALACCOUNT_PROVIDERS = {
    'google': {
        'SCOPE': [
            'profile',
            'email',
        ],
        'AUTH_PARAMS': {
            'access_type': 'online',
        },

    }
}
django provider socialauth
1个回答
0
投票

您的问题可能是由向后不兼容的更改引起的。 询问 docs 说,如果您不使用任何社交帐户功能,pip install django-allauth 将不再引入用于处理 JWT 的依赖项。

使用

pip install django-allauth[socialaccount]

© www.soinside.com 2019 - 2024. All rights reserved.