From bb053d69114bf0c89d304b8fc2b0f3681a5f39d4 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Fri, 20 Jun 2025 11:38:48 +0000 Subject: [PATCH] API: auth: Add an endpoint for the currently logged in user Signed-off-by: Michael Tremer --- src/api/auth.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/api/auth.py b/src/api/auth.py index 7cfce981..0293ff7c 100644 --- a/src/api/auth.py +++ b/src/api/auth.py @@ -209,5 +209,9 @@ async def auth_refresh(request: fastapi.Request, data: typing.Optional[RefreshRe # Send the response return AuthResponse(access_token=access_token, refresh_token=refresh_token) +@router.get("/whoami") +async def whoami(current_principal = fastapi.Depends(get_current_principal)) -> users.User: + return current_principal + # Add everything to the app apiv1.include_router(router) -- 2.47.3