我正在尝试将Facebook登录信息集成到我的应用中。当我将一个Facebook帐户与该用户相关联然后注销时,使用facebook的登录按预期工作。但是如果用户断开了他的facebook的连接,并且当我单击使用facebook的登录时,我会在以下位置收到完整性错误:
IntegrityError at /oauth/complete/facebook/
duplicate key value violates unique constraint "accounts_user_email_key"
DETAIL: Key (email)=() already exists.
我正在使用social-auth-app-django
在我的settings.py中,我有:
DEFAULT_AUTH_PIPELINE = (
'social_core.pipeline.social_auth.social_details',
'social_core.pipeline.social_auth.social_uid',
'social_core.pipeline.social_auth.auth_allowed',
'social_core.pipeline.social_auth.social_user',
'social_core.pipeline.user.get_username',
'social_core.pipeline.mail.mail_validation',
'social_core.pipeline.social_auth.associate_by_email',
'social_core.pipeline.user.create_user',
'social_core.pipeline.social_auth.associate_user',
'social_core.pipeline.social_auth.load_extra_data',
'social_core.pipeline.user.user_details'
)
答案 0 :(得分:0)
重新排列管道就可以了!
SOCIAL_AUTH_PIPELINE = (
'social_core.pipeline.user.get_username',
'social_core.pipeline.mail.mail_validation',
'social_core.pipeline.social_auth.social_uid',
'social_core.pipeline.social_auth.associate_user',
'social_core.pipeline.social_auth.load_extra_data',
'social_core.pipeline.user.user_details',
'social_core.pipeline.social_auth.social_details',
'social_core.pipeline.social_auth.auth_allowed',
'social_core.pipeline.social_auth.social_user',
)