Skip to content

Commit feebf41

Browse files
committed
work around race condition in which two threads both try to create the same AccessToken
1 parent 99b4763 commit feebf41

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

oauth2_provider/oauth2_validators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ def _get_token_from_authentication_server(
335335
try:
336336
access_token = AccessToken.objects.select_related("application", "user").get(token=token)
337337
except AccessToken.DoesNotExist:
338-
access_token = AccessToken.objects.create(
338+
access_token, _created = AccessToken.objects.get_or_create(
339339
token=token,
340340
user=user,
341341
application=None,

0 commit comments

Comments
 (0)