我正在尝试使用django social auth for linkedin作为我的用户的登录信息。我想从用户帐户中获取额外的值。我已经在settings.py
,
LINKEDIN_SCOPE = ['r_basicprofile', 'r_emailaddress','r_fullprofile']
但我得到的回复只是用户的基本个人资料信息。 我怎样才能获得所有提到的范围信息?
答案 0 :(得分:6)
您的设置中缺少某些内容。在您要添加范围后,您应该在设置中添加 LINKEDIN_EXTRA_FIELD_SELECTORS 和 LINKEDIN_EXTRA_DATA 。
示例:强>
LINKEDIN_SCOPE = ['r_basicprofile', 'r_emailaddress','r_fullprofile']
LINKEDIN_EXTRA_FIELD_SELECTORS = ['email-address','positions', 'headline','summary','picture-url','site-standard-profile-request','public-profile-url','location','interests','skills','languages',]
LINKEDIN_EXTRA_DATA = [('id', 'id'), ('first-name', 'first_name'), ('last-name', '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'),]