geeViz.eeAuth.server¶
FastAPI proxy for Earth Engine that injects per-tenant SA tokens.
The proxy receives requests from EE clients (browser JS, Python SDK
via geeViz.eeAuth.client), looks up the requested tenant in the SA
registry, mints a token (cached), and forwards to the real EE endpoint
with the right Authorization and x-goog-user-project headers.
Two ways to use:
Standalone:
python -m geeViz.eeAuth --port 8888
or programmatically:
from geeViz.eeAuth.server import create_proxy_app app = create_proxy_app() # serve with uvicorn / etc.
Mounted in an existing FastAPI app:
from fastapi import FastAPI from geeViz.eeAuth.server import build_proxy_router app = FastAPI() app.include_router(build_proxy_router(), prefix="/ee-api")
Tenant routing — the proxy picks the SA in this order:
X-geeViz-Credsrequest header (server-side EE SDK; set bygeeViz.eeAuth.client.TenantAwareHttp).?tenant=query string parameter (browser map iframes).Default tenant (the registry’s
defaultentry, loaded fromGEE_SERVICE_ACCOUNT_B64).
Workload tagging — every POST is stamped with a workload tag
ee-proxy__<tenant> in the query string for billing attribution.
Pass workload_tag_builder=... to build_proxy_router if you want
to construct your own tag (e.g. include user / session).
Functions
|
Build a FastAPI |
|
Build a standalone FastAPI app with the proxy mounted at |