How can I retrieve profile picture and date of birth from google and facebook using python-social-auth by extending pipeline? I\'ve read that I can make functions to do so and s
The above answers may not work (it did not work for me) as the facebook profile URL does not work anymore without accesstoken. The following answer worked for me.
def save_profile(backend, user, response, is_new=False, *args, **kwargs):
if is_new and backend.name == "facebook":
# The main part is how to get the profile picture URL and then do what you need to do
Profile.objects.filter(owner=user).update(
imageUrl='https://graph.facebook.com/{0}/picture/?type=large&access_token={1}'.format(response['id'],
response[
'access_token']))
elif backend.name == 'google-oauth2':
if is_new and response.get('picture'):
Profile.objects.filter(owner=user).update(imageUrl=response['picture'])
add to the pipeline in setting.py,
SOCIAL_AUTH_PIPELINE+ = ('.save_profile')