From fb630b47cb530c3b5b3d593731bb146e2bde41d5 Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Fri, 13 Mar 2026 11:09:49 +0800 Subject: [PATCH] feat: implement PolyWeather Web Map API backend with FastAPI, integrating weather data, analysis, authentication, and payment processing. --- web/app.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/web/app.py b/web/app.py index e12b9c14..99d523a6 100644 --- a/web/app.py +++ b/web/app.py @@ -212,6 +212,14 @@ def _require_supabase_identity(request: Request) -> Dict[str, str]: status_code=503, detail="payment requires SUPABASE_URL and SUPABASE_ANON_KEY", ) + + # Reuse identity already bound in _assert_entitlement/_bind_optional_supabase_identity + # to avoid requiring a second successful token parse in the same request flow. + state_user_id = str(getattr(request.state, "auth_user_id", "") or "").strip() + if state_user_id: + state_email = str(getattr(request.state, "auth_email", "") or "").strip() + return {"user_id": state_user_id, "email": state_email} + token = extract_bearer_token(request.headers.get("authorization")) if token: identity = SUPABASE_ENTITLEMENT.get_identity(token)