omab / python-social-auth

Social auth made simple
http://psa.matiasaguirre.net
BSD 3-Clause "New" or "Revised" License
2.83k stars 1.09k forks source link

'QuerySet' object has no attribute 'social_auth' #1084

Closed joshlsullivan closed 7 years ago

joshlsullivan commented 7 years ago

I am following the example:

import requests

user = User.objects.get(...) social = user.social_auth.get(provider='google-oauth2') response = requests.get( 'https://www.googleapis.com/plus/v1/people/me/people/visible', params={'access_token': social.extra_data['access_token']} ) friends = response.json()['items']

found here. I get the error AttributeError: 'QuerySet' object has no attribute 'social_auth'. Any ideas?

omab commented 7 years ago

Ensure that the user is indeed a user instance and not a queryset.