I
I
Ivan2015-07-28 17:13:41
Django
Ivan, 2015-07-28 17:13:41

How to get a response from the social. networks using django-social-auth?

Good day. How to intercept the response of the social. networks using django-social-auth?
After authorization on the site through the social. the network is created by a user model in the admin panel, but it became necessary to save, in addition to username, also email and profile picture. Can you please tell me how can I get the social-auth response immediately after login?
Thanks a lot.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
U
un1t, 2015-07-28
@un1t

All social networks are different, email can be done like this
settings.py

SOCIAL_AUTH_GOOGLE_OAUTH2_SCOPE = [
    'https://www.googleapis.com/auth/userinfo.email',
    'https://www.googleapis.com/auth/userinfo.profile'
]

SOCIAL_AUTH_VK_OAUTH2_SCOPE = ['email']

SOCIAL_AUTH_TWITTER_SCOPE = ['email']

SOCIAL_AUTH_FACEBOOK_SCOPE = ['email']

And download the avatars yourself, for this you can use the pipeline
SOCIAL_AUTH_PIPELINE = (
    ...
    'apps.accounts.social.save_avatar', # это твоя кастомная функция
    ...
)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question