Skip to content

Commit 1425267

Browse files
committed
pass along refresh token instance inside request object
1 parent 1623bcf commit 1425267

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

oauth2_provider/oauth2_validators.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -331,10 +331,9 @@ def validate_user(self, username, password, client, request, *args, **kwargs):
331331
return False
332332

333333
def get_original_scopes(self, refresh_token, request, *args, **kwargs):
334-
# Avoid second query for RefreshToken since this method is invoked *after* validate_refresh_token.
335-
rt = request.refresh_token
336-
# Restore request.refresh_token
337-
request.refresh_token = rt.token
334+
# Avoid second query for RefreshToken since this method is invoked *after*
335+
# validate_refresh_token.
336+
rt = request.refresh_token_instance
338337
return rt.access_token.scope
339338

340339
def validate_refresh_token(self, refresh_token, client, request, *args, **kwargs):
@@ -345,8 +344,9 @@ def validate_refresh_token(self, refresh_token, client, request, *args, **kwargs
345344
try:
346345
rt = RefreshToken.objects.get(token=refresh_token)
347346
request.user = rt.user
347+
request.refresh_token = rt.token
348348
# Temporary store RefreshToken instance to be reused by get_original_scopes.
349-
request.refresh_token = rt
349+
request.refresh_token_instance = rt
350350
return rt.application == client
351351

352352
except RefreshToken.DoesNotExist:

0 commit comments

Comments
 (0)