Fetching the Google profile picture while using Django Social Auth

Karan Mhatre
1 min readApr 14, 2020


We will be using the social-auth-app-django package to manage OAuth for our website.

You can follow the docs for social auth to implement the basic version of Google OAUTH.

To also fetch the Google Profile Picture you need two more steps,

1. Add a new function in your views.

I have added it in posts/views.py in my case

As you can see, I have a model named UserProfile(one-to-one relation with the User Model) that has a field called picture. I am creating a new UserProfile object with the current user, and the newly fetched picture url and saving it.

My UserProfile model in models.py

2. Add a path to this function in the SOCIAL_AUTH_PIPELINE variable in your settings.py. This will make sure that your function is called each time a user logs in using OAuth.


This will run each time the user logs in using Google.

If you want it to only run the first time a user registers on the website, you can add the following condition.

if kwargs[‘is_new’]:

And that’s it.