Tokens

Almost every service covered provides some kind of API that is protected with access_token or token pairs (like Twitter OAuth keys). These tokens are gathered by the authentication mechanism and stored in UserSocialAuth.extra_data.

UserSocialAuth has a property named tokens to easily access these useful values, which returns a dictionary containing the token values. A simple usage example:

>>> from pprint import pprint
>>> from social_auth.models import UserSocialAuth
>>> instance = UserSocialAuth.objects.filter(provider='twitter').get(...)
>>> pprint(instance.tokens)
{u'oauth_token': u'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
 u'oauth_token_secret': u'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'}
>>> instance = UserSocialAuth.objects.filter(provider='facebook').get(...)
>>> pprint(instance.tokens)
{u'access_token': u'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'}