36👍
Given a user instance, you can get the token by doing this:
social = user.social_auth.get(provider='provider name')
social.extra_data['access_token']
Assuming Facebook provider:
social = user.social_auth.get(provider='facebook')
social.extra_data['access_token']
👤omab
2👍
http://python-social-auth.readthedocs.org/en/latest/use_cases.html#retrieve-google-friends
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']}
)
- How can I send e-mail from django using the google smtp server?
- Django no module named "compressor"
- 'TopLevelDocumentMetaclass' object is not iterable
- Best Practices: How to best implement Rating-Stars in Django Templates
Source:stackexchange.com