From 6b2f5f81f74e1f0cf0e81a02d5fd497c4b671139 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 b02b98075..162112d21 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