token-type-tolerance

This commit is contained in:
2023-10-13 14:45:24 +03:00
parent 792d60453a
commit e9f68c8fb1
3 changed files with 9 additions and 0 deletions

View File

@@ -28,6 +28,9 @@ class JWTAuthenticate(AuthenticationBackend):
return AuthCredentials(scopes={}, error_message=str("no token")), AuthUser(
user_id=None, username=""
)
if token.startswith("Bearer"):
token = token[len("Bearer "):]
if len(token.split(".")) > 1:
payload = await SessionToken.verify(token)