Django/python-social-auth:LinkedIn额外数据在某些字段上返回null [英] Django/ python-social-auth: LinkedIn extra data returns null on some fields

查看:78
本文介绍了Django/python-social-auth:LinkedIn额外数据在某些字段上返回null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用python-social-auth来检索Django中的LinkedIn个人资料数据.

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>

是用于登录LinkedIn的链接.

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

但是,当我检查额外的数据时,它仅正确返回名字,姓氏,访问令牌和ID.其他所有内容都为空.

However, when I check the extra data, it returns only the first name, last name, access token and id correctly. Everything else is null.

我想念什么?

推荐答案

获取额外数据的设置必须采用以下格式:

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']

这篇关于Django/python-social-auth:LinkedIn额外数据在某些字段上返回null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆