From 57407bbd91c3e2a9705fcd59cf9cb88783b51c25 Mon Sep 17 00:00:00 2001 From: Chris Christiansen Date: Wed, 24 Jun 2026 15:59:50 +0000 Subject: [PATCH] fix: /auth/me les IAP-header istedenfor session --- main.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 519cf09..5b75084 100644 --- a/main.py +++ b/main.py @@ -135,10 +135,12 @@ async def auth(request: Request): @app.get("/auth/me") async def me(request: Request): - user = request.session.get("user") - if not user: + email = request.headers.get("x-goog-authenticated-user-email", "") + if not email: raise HTTPException(status_code=401, detail="Not authenticated") - return JSONResponse(user) + # IAP sender "accounts.google.com:chris@vauco.no" - vi fjerner prefix + clean_email = email.split(":")[-1] + return JSONResponse({"email": clean_email, "authenticated": True}) @app.get('/auth/logout') async def logout(request: Request):