1👍
Never used django-social-friends-finder
, but I guess it calls https://www.googleapis.com/plus/v1/people/me/people/visible
at some point to retrieve your friends list. But to access that API you need to specify the correct scope, that way your access token has permissions for it. To do so in django-social-auth
define this setting:
GOOGLE_OAUTH_EXTRA_SCOPE = [
'https://www.googleapis.com/auth/plus.login'
]
Also this snippet shows how you can retrieve your friends list:
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']
👤omab
Source:stackexchange.com