Search code examples
pythondjangodjango-allauthsocialauth

django-allauth facebook login issue with facebook accounts that is not connected to any email address


I have a site where users have to login only using facebook. Most of time it works fine. But sometimes, when user logins with facebook, it again asks for email address.

But I have a new issue. Those facebook made with mobile number and not any email address connected to it are not able to login.

So how can i solve this problem ?

I am using django-allauth for social login.


Solution

  • Just my assumption but because facebook don't allow you to retrieve phone_number from GRAPH anymore it will use the blank email so you will have duplicate blank email if it pass From the configuration docs https://django-allauth.readthedocs.io/en/latest/configuration.html

    SOCIALACCOUNT_AUTO_SIGNUP (=True)

    Attempt to bypass the signup form by using fields (e.g. username, email) retrieved from the social account provider. If a conflict arises due to a duplicate e-mail address the signup form will still kick in.

    So the user are required to manually input the email address if they don't have email

    My suggestion to this is using the signals of allauth save email with some kind of format for example timestamp with pre_social_login signals https://django-allauth.readthedocs.io/en/latest/signals.html