Skip to content

Commit

Permalink
fix: add check for when the refresh_token is None.
Browse files Browse the repository at this point in the history
  • Loading branch information
wagnerdelima committed Dec 26, 2021
1 parent 76e47fc commit b0fa93f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion oauth2_provider/oauth2_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,9 @@ def _create_refresh_token(self, request, refresh_token_code, access_token):
# is an access token linked to a refresh token is valid, but the refresh token
# is revoked, the refresh token is deleted and a new refresh token is created
# with the still valid access token.
refresh_token.delete()
if refresh_token:
refresh_token.delete()

return RefreshToken.objects.create(
user=request.user,
token=refresh_token_code,
Expand Down

0 comments on commit b0fa93f

Please sign in to comment.