Django社交认证,输出额外的价值

时间:2013-02-19 05:39:04

标签: django django-socialauth

我正在尝试使用django social auth for linkedin作为我的用户的登录信息。我想从用户帐户中获取额外的值。我已经在settings.py

中提到了参数
LINKEDIN_SCOPE = ['r_basicprofile', 'r_emailaddress','r_fullprofile']

但我得到的回复只是用户的基本个人资料信息。 我怎样才能获得所有提到的范围信息?

1 个答案:

答案 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'),]

LinkedIn Developers Profile Fields API