'Getting email from LoggedIn user with Github

I have successfully setup Django with Django-allauth to register with Github but even if inside the scope on settings and asking for , it does not store the user's email address on the database.

Here is the settings block:

SOCIALACCOUNT_PROVIDERS = {
    'github': {
        'SCOPE': [
            'user',
            'emails',
            'repo',
            'read:org',
        ],
    }
}

ACCOUNT_EMAIL_REQUIRED = True

Is there any configuration left to do or am I doing something wrong?



Solution 1:[1]

I have found the answer. Django-allauth provides the email by accessing the extra data.

from allauth.socialaccount.models import SocialAccount

SocialAccount.objects.all()

Solution 2:[2]

add this line in settings.py and it will work fine

SOCIALACCOUNT_QUERY_EMAIL = True

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Rodragon
Solution 2 NourEldin Osama