Zags
Zags

Reputation: 41358

Django-allauth OAuth2 refresh token

When using django-allauth to do OAuth2 authentication, I can find the OAuth token using the following (bitbucket_oauth2 is the provider in the example):

account = user.socialaccount_set.get(provider="bitbucket_oauth2")
token = account.socialtoken_set.first().token

This token is only valid for an hour. Where is the refresh token stored?

Upvotes: 3

Views: 1719

Answers (1)

Zags
Zags

Reputation: 41358

The refresh token can be found in:

account = user.socialaccount_set.get(provider="bitbucket_oauth2")
refresh_token = account.socialtoken_set.first().token_secret

Upvotes: 3

Related Questions