pellersr-u2i23h/endpoints/logout.post.py
2025-03-28 10:47:17 +01:00

15 lines
512 B
Python

# Entity: User
from fastapi import APIRouter, Depends, status
from fastapi.security import OAuth2PasswordBearer
from models.user import User
from schemas.user import UserSchema
router = APIRouter()
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
@router.post("/logout", status_code=status.HTTP_200_OK)
async def logout(token: str = Depends(oauth2_scheme)):
# Implement logout logic here
# For example, invalidate the token or remove it from the cache
return {"message": "Logout successful"}