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?
The refresh token can be found in:
account = user.socialaccount_set.get(provider="bitbucket_oauth2")
refresh_token = account.socialtoken_set.first().token_secret
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With