This commit is contained in:
cheykrym 2026-04-05 19:58:14 +03:00
parent 170ff621db
commit e72749a150
2 changed files with 7 additions and 7 deletions

View File

@ -145,12 +145,12 @@ def _extract_token_from_request(request: Request) -> Optional[str]:
2. Если нет из куки yobble_access_token 2. Если нет из куки yobble_access_token
3. Если нигде нет возвращает None 3. Если нигде нет возвращает None
""" """
# 1. Пробуем заголовок # # 1. Пробуем заголовок
auth_header = request.headers.get("Authorization") # auth_header = request.headers.get("Authorization")
if auth_header and auth_header.startswith("Bearer "): # if auth_header and auth_header.startswith("Bearer "):
token = auth_header[7:].strip() # Убираем "Bearer " # token = auth_header[7:].strip() # Убираем "Bearer "
if token: # Не пустой # if token: # Не пустой
return token # return token
# 2. Пробуем куку (если httponly=False, фронт мог не подставить в заголовок) # 2. Пробуем куку (если httponly=False, фронт мог не подставить в заголовок)
cookie_token = request.cookies.get("yobble_access_token") cookie_token = request.cookies.get("yobble_access_token")

View File

@ -1,6 +1,6 @@
[project] [project]
name = "common-lib" name = "common-lib"
version = "0.0.54" version = "0.0.55"
description = "Библиотека общих компонентов для микросервисов yobble" description = "Библиотека общих компонентов для микросервисов yobble"
authors = [{ name = "cheykrym", email = "you@example.com" }] authors = [{ name = "cheykrym", email = "you@example.com" }]
license = "MIT" license = "MIT"