From 4ffcbf36d39342e5a64f3ad30c43b0ce5f17ff23 Mon Sep 17 00:00:00 2001 From: Untone Date: Sun, 22 Dec 2024 00:30:04 +0300 Subject: [PATCH] nobearer --- services/auth.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/auth.py b/services/auth.py index 2e680b87..00af99bb 100644 --- a/services/auth.py +++ b/services/auth.py @@ -22,6 +22,10 @@ async def check_auth(req): - user_roles: list[str] - Список ролей пользователя. """ token = req.headers.get("Authorization") + # Проверяем и очищаем токен от префикса Bearer если он есть + if token.startswith('Bearer '): + token = token.split('Bearer ')[-1].strip() + host = req.headers.get('host', '') logger.debug(f"check_auth: host={host}") auth_url = AUTH_URL