From b0ce48ff27c3f5b06d6aef56d3eccbb68e9438dc Mon Sep 17 00:00:00 2001 From: Retief Visser Date: Fri, 13 Mar 2020 14:22:20 +1100 Subject: [PATCH] Fix fetching old access_token from refresh_token --- oauth2_provider/oauth2_validators.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/oauth2_provider/oauth2_validators.py b/oauth2_provider/oauth2_validators.py index 9027a4841..f4075012e 100644 --- a/oauth2_provider/oauth2_validators.py +++ b/oauth2_provider/oauth2_validators.py @@ -634,7 +634,9 @@ def validate_refresh_token(self, refresh_token, client, request, *args, **kwargs seconds=oauth2_settings.REFRESH_TOKEN_GRACE_PERIOD_SECONDS ) ) - rt = RefreshToken.objects.filter(null_or_recent, token=refresh_token).first() + rt = RefreshToken.objects.filter(null_or_recent, token=refresh_token).select_related( + 'access_token' + ).first() if not rt: return False