问题
I am using python-social-auth to retrieve LinkedIn profile data in Django.
<a href="{% url 'social:begin' 'linkedin-oauth2' %}?next={{ request.path }}">Login with LinkedIn</a>
is the link to login with LinkedIn.
SOCIAL_AUTH_LINKEDIN_OAUTH2_EXTRA_DATA = [('id', 'id'), ('firstName', 'first_name'), ('lastName', 'last_name'), ('email-address', 'email_address'), ('positions', 'positions'), ('summary', 'summary'), ('headline', 'headline'), ('picture-url', 'picture_url'),
('site-standard-profile-request', 'site_standard_profile_request'), ('public-profile-url', 'public_profile_url'), ('location', 'location'), ('interests', 'interests'), ('skills', 'skills'), ('languages', 'languages'),]
However, when I check the extra data, it returns only the first name, last name, access token and id correctly. Everything else is null.
What am I missing?
回答1:
The settings to obtain the extra data must be in the following format:
SOCIAL_AUTH_LINKEDIN_FIELD_SELECTORS = [
'public-profile-url',
'email-address',
'interests',
'skills',
]
SOCIAL_AUTH_LINKEDIN_SCOPE = ['r_basicprofile', 'r_emailaddress']
来源:https://stackoverflow.com/questions/26271545/django-python-social-auth-linkedin-extra-data-returns-null-on-some-fields