fixed no auth header error

This commit is contained in:
Alexander Karpov 2022-06-05 21:28:20 +03:00
parent 80a63fe252
commit acc37f8e82

View File

@ -6,8 +6,8 @@ from .services.jwt import read_jwt
class PlayerAuthentication(authentication.BaseAuthentication):
def authenticate(self, request):
token = request.headers["Authorization"]
if not token:
if "Authorization" not in request.headers or not (token := request.headers["Authorization"]):
raise exceptions.AuthenticationFailed("No credentials provided.")
t = read_jwt(token)