Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python社交身份验证受保护的用户字段问题_Python_Django_Python Social Auth - Fatal编程技术网

Python社交身份验证受保护的用户字段问题

Python社交身份验证受保护的用户字段问题,python,django,python-social-auth,Python,Django,Python Social Auth,我已经设置了Python Social Auth,如下所示 SOCIAL_AUTH_STRATEGY = 'social.strategies.django_strategy.DjangoStrategy' SOCIAL_AUTH_STORAGE = 'social.apps.django_app.default.models.DjangoStorage' SOCIAL_AUTH_USERNAME_IS_FULL_EMAIL = True SOCIAL_AUTH_PROTECTED_USER_F

我已经设置了Python Social Auth,如下所示

SOCIAL_AUTH_STRATEGY = 'social.strategies.django_strategy.DjangoStrategy'
SOCIAL_AUTH_STORAGE = 'social.apps.django_app.default.models.DjangoStorage'
SOCIAL_AUTH_USERNAME_IS_FULL_EMAIL = True
SOCIAL_AUTH_PROTECTED_USER_FIELDS = ['email', 'first_name', 'last_name']
我的管道如下

SOCIAL_AUTH_PIPELINE = (
    'social.pipeline.social_auth.social_details',
    'social.pipeline.social_auth.social_uid',
    'social.pipeline.social_auth.auth_allowed',
    'social.pipeline.social_auth.social_user',
    'social.pipeline.user.get_username',
    'social.pipeline.social_auth.associate_by_email',
    'social.pipeline.user.create_user',
    'social.pipeline.social_auth.associate_user',
    'social.pipeline.social_auth.load_extra_data',
    'social.pipeline.user.user_details'
)
根据设置,如果新用户使用社交帐户登录,则应使用first_name和last_name创建用户详细信息。我得到的是一个名和姓都为空的用户。如果我删除了受社会身份验证保护的用户字段,那么在创建新用户时,我会得到名字和姓氏


那么,如何在创建新用户时获取名字和姓氏,并且在下次登录时从不更新这些字段?

此更改应该可以解决此问题,感谢@omab解决此问题。