fix: middlewaer acces token auth

This commit is contained in:
TheNoxium
2025-04-29 21:16:59 +05:00
parent b90b70568c
commit 19f8236b47
8 changed files with 164 additions and 103 deletions

View File

@@ -26,8 +26,6 @@ from api.services.auth import authenticate_user
from api.db.logic.auth import add_new_refresh_token,upgrade_old_refresh_token
from api.db.logic.account import get_user_login
from api.schemas.endpoints.auth import Auth
api_router = APIRouter(
@@ -54,13 +52,13 @@ def get_config():
return Settings()
@api_router.post("/")
@api_router.post("")
async def login_for_access_token(
user: Auth,
response: Response,
connection: AsyncConnection = Depends(get_connection_dep),
Authorize: AuthJWT = Depends(),
):
user: Auth,
response: Response,
connection: AsyncConnection = Depends(get_connection_dep),
Authorize: AuthJWT = Depends(),
):
"""Авторизирует, выставляет токены в куки."""
@@ -109,10 +107,10 @@ async def login_for_access_token(
@api_router.post("/refresh")
async def refresh(
request: Request,
connection: AsyncConnection = Depends(get_connection_dep),
Authorize: AuthJWT = Depends()):
"""Обновляет access токен."""
request: Request,
connection: AsyncConnection = Depends(get_connection_dep),
Authorize: AuthJWT = Depends()
):
refresh_token = request.cookies.get("refresh_token_cookie")
print("Refresh Token:", refresh_token)