Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Added social auth response data to session. #640

wants to merge 1 commit into from

2 participants


For GitHub auth, this gives access to attributes like the user's avatar.

Is this the right way to go about doing this? Or is the data accessible some other way? Thanks!

@rca rca Added social auth response data to session.
For GitHub auth, this gives access to attributes like the user's avatar.

For that purpose is the extra data processing, check the doc at, basically you define in that setting the key names of data you want to store in the UserSocialAuth instance.

@omab omab closed this

I knew there had to be a better way, thanks! However, I'm not understanding the documentation. :confused:

I'm looking to get some extra values from GitHub's OAuth response. For example, below is a subset of GitHub's response data:

        'avatar_url': '[...]',
        'created_at': '2009-02-11T02:18:24Z',
        'email': '',
        'id': 53537,
        'login': 'rca'
        'name': 'Roberto Aguilar',

The documentation states to define the setting GITHUB_EXTRA_DATA to access this stuff. From the page you reference, I did not understand why there is a need for a list of 2-tuples, nor where I access this data from once I define it. I added the following to my settings:

    ('avatar_url', 'avatar_url'),

Now that I've configured GITHUB_EXTRA_DATA to give me access to avatar_url, how do I access it?



The two-tuples are in the form key name in response, alias value to store it, the alias was added to uniform the retrieved data between providers, for example if you use Github and Facebook backends, you will know that given any UserSocialAuth instance, you will find the avatar under a same key and avoid any backend-type check to use the correct key.

Once the data is stored, you can access it under the extra_data attribute in the UserSocialAuth instance, for example, given a user instance you can get it in this way:


@omab, thanks, got it working. I'm opening up another PR for some doc enhancement.

@rca rca deleted the baremetal-deps:add-extra-response-data-to-session branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 20, 2013
  1. @rca

    Added social auth response data to session.

    rca committed
    For GitHub auth, this gives access to attributes like the user's avatar.
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 0 deletions.
  1. +3 −0  social_auth/backends/contrib/
3  social_auth/backends/contrib/
@@ -95,6 +95,9 @@ def user_data(self, access_token, *args, **kwargs):
if not response.code == 204:
data = None
+ request = kwargs['request']
+ request.session['social_auth_data'] = data
return data
# Backend definition
Something went wrong with that request. Please try again.