I am using python-social-auth to log in my own web application from LinkedIn. I successfully logged in and redirect to my home page. The next step is to utilize the extra data (i.e. UserSocialAuth.extra_data). Could anyone give a example about how to access the extra data in either Django templates or Django views?
This is the settings I had.
SOCIAL_AUTH_LOGIN_URL = ''
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'
)
SOCIAL_AUTH_LINKEDIN_OAUTH2_SCOPE = ['r_basicprofile', 'r_emailaddress', 'rw_company_admin', 'w_share']
SOCIAL_AUTH_LINKEDIN_OAUTH2_FIELD_SELECTORS = ['first-name', 'last-name', 'email-address', 'headline']
SOCIAL_AUTH_LINKEDIN_OAUTH2_EXTRA_DATA = [('id', 'id'),
('first-name', 'first_name'),
('last-name', 'last_name'),
('email-address', 'email_address'),
('headline', 'headline'),
('industry', 'industry')]
What I am going to do is like:
<html><body>Here we go! {{ user.first_name }} {{ user.last_name }}
{{ user.email }}
{{ user.extra_data.headline }}</body></html>
Any comments will be highly appreciated!