Ronen Ness
Ronen Ness

Reputation: 10740

python social auth linkedin picture url is null

I'm using python social auth with django to login via LinkedIn and I try to obtain the public picture URL. However, no matter what I do I keep getting null. I tried every combination possible, from public-picture-url to pictureUrl, every combo of underscores, CamelCase and dash, with or without "public". Nothing works.

here's my (current) settings:

SOCIAL_AUTH_LINKEDIN_SCOPE = ['r_basicprofile', 'r_emailaddress']
SOCIAL_AUTH_LINKEDIN_FIELD_SELECTORS = ['picture-url', 'email-address', 'headline', 'industry']
SOCIAL_AUTH_LINKEDIN_EXTRA_DATA = [('id', 'li_id'),
                               ('firstName', 'first_name'),
                               ('lastName', 'last_name'),
                               ('emailAddress', 'email_address'),
                               ('headline', 'headline'),
                               ('picture-url', 'picture_url')]

AUTHENTICATION_BACKENDS = (
'social_auth.backends.contrib.linkedin.LinkedinBackend',
'django.contrib.auth.backends.ModelBackend',
)

PS I've seen this Django/ python-social-auth: LinkedIn extra data returns null on some fields and it didn't help.

Upvotes: 0

Views: 682

Answers (1)

Ronen Ness
Ronen Ness

Reputation: 10740

apparently collecting extra data is not in the pipeline by default. this solved it:

SOCIAL_AUTH_PIPELINE = (
    'social.pipeline.social_auth.social_details',
    'social.pipeline.social_auth.social_uid',
    'social.pipeline.social_auth.auth_allowed',
    'social.pipeline.social_auth.social_user',
    'social.pipeline.user.get_username',
    'social.pipeline.user.create_user',
    'social.pipeline.social_auth.associate_user',
    'social.pipeline.social_auth.load_extra_data',
    'social.pipeline.user.user_details'
)

Upvotes: 1

Related Questions