Search code examples
djangolinkedin-apipython-social-auth

linkedin email address not recieved using python socail auth


I have my linkedin scope set as follows:

SOCIAL_AUTH_LINKEDIN_SCOPE = ['r_basicprofile', 'r_emailaddress']

When I try logging in using python social auth then an exception is raised which is defined in my model:

if not email:
            raise ValueError('Users must have an email address')

while logging in with facebook and google work fine but not linkedin

The error means it does not have email field in it. I am working on my localhost


Solution

  • It looks like for linkedin we need to specify field selectors in order to get email address and other information from it unlike facebook and google. This is what i was missing:

    SOCIAL_AUTH_LINKEDIN_FIELD_SELECTORS = ['email-address']