Duplicate Email Address in Django AllAuth

It sounds like you might be encountering this issue: Integrity error during social login: duplicate key violates unique constraint on user table · Issue #3266 · pennersr/django-allauth · GitHub.

A workaround is to use one of the suggested fixes in your own signup form. E.g.

class CustomSocialSignupForm(SocialSignupForm):
    """Custom social signup form to work around this issue:
    https://github.com/pennersr/django-allauth/issues/3266"""
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.prevent_enumeration = False

Then in settings.py

SOCIALACCOUNT_FORMS = {
    "signup": "apps.users.forms.CustomSocialSignupForm",
}
1 Like