Изменил вебсокет
This commit is contained in:
parent
8589fec679
commit
7759cdf64d
1 changed files with 6 additions and 5 deletions
|
@ -1,4 +1,6 @@
|
|||
from fastapi import Depends, WebSocket
|
||||
from typing import Annotated
|
||||
|
||||
from fastapi import Depends, Header
|
||||
from fastapi.security import HTTPBearer
|
||||
from jose import JWTError, jwt, ExpiredSignatureError
|
||||
|
||||
|
@ -49,11 +51,10 @@ async def check_verificated_user_with_exc(user: SUser = Depends(get_current_user
|
|||
return user
|
||||
|
||||
|
||||
def get_token_ws(websocket: WebSocket) -> str:
|
||||
token = websocket.cookies.get("black_phoenix_access_token")
|
||||
if not token:
|
||||
def get_token_ws(authorization: Annotated[str | None, Header()] = None) -> str:
|
||||
if authorization in None:
|
||||
raise TokenAbsentException
|
||||
return token
|
||||
return authorization.split()[1]
|
||||
|
||||
|
||||
async def get_current_user_ws(token: str = Depends(get_token_ws), uow=Depends(UnitOfWork)):
|
||||
|
|
Loading…
Add table
Reference in a new issue