[Python] Django-allauth - Make phone number optional for SocialLogin

Discussão em 'Python' iniciado por Stack, Junho 3, 2025.

  1. Stack

    Stack Membro Participativo

    I am using django-allauth in my project and I have configured Google as a SocialAuth provider. I have a custom signal receiver that updates the phone number on the SocialAuthAccount after the user signs up. But currently the system throws an error when the user logins via SocialAuth if they do not have a public phone number on their account. I am getting an error - KeyError 'phone' at - allauth/account/internal/flows/phone_verification.py - line 46.

    This is my relevant settings.py:

    ACCOUNT_LOGIN_METHODS = {"phone", "email", "username"}
    ACCOUNT_SIGNUP_FIELDS = [
    "phone*",
    "email*",
    "username*",
    "password1",
    "password2"
    ]


    How can I tell the SocialAuthAdapter that phone number is optional and might not be there?

    Continue reading...

Compartilhe esta Página