@@ -331,10 +331,9 @@ def validate_user(self, username, password, client, request, *args, **kwargs):
331
331
return False
332
332
333
333
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
338
337
return rt .access_token .scope
339
338
340
339
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
345
344
try :
346
345
rt = RefreshToken .objects .get (token = refresh_token )
347
346
request .user = rt .user
347
+ request .refresh_token = rt .token
348
348
# Temporary store RefreshToken instance to be reused by get_original_scopes.
349
- request .refresh_token = rt
349
+ request .refresh_token_instance = rt
350
350
return rt .application == client
351
351
352
352
except RefreshToken .DoesNotExist :
0 commit comments