From 6e7970d5e3a982bebfeb519008ea389203284adc Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Fri, 20 Oct 2023 22:43:59 +0200 Subject: [PATCH] add method delete --- app/routers/token.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/routers/token.py b/app/routers/token.py index 02defe6..8b13860 100644 --- a/app/routers/token.py +++ b/app/routers/token.py @@ -34,4 +34,11 @@ async def login_for_access_token( async def check_token(current_user: Annotated[users.User, Depends(users_token.get_current_active_user)], authorize: Annotated[bool, Depends(permissions_checker.PermissionChecker(roles=["Admin", "User"]))]): content = {"message": "Check token"} response = JSONResponse(content=content) + return response + +@router.delete("/token",tags=["token"]) +async def check_token(current_user: Annotated[users.User, Depends(users_token.get_current_active_user)], authorize: Annotated[bool, Depends(permissions_checker.PermissionChecker(roles=["Admin", "User"]))]): + content = {"message": "Token deleted"} + response = JSONResponse(content=content) + response.set_cookie(key="access_token", value="", httponly=True) return response \ No newline at end of file