Authentication
Users sign up and sign in with Supabase Auth in the web app. The API never handles passwords; it verifies the access token on each request.Flow
Verification (app/utils/auth.py)
- Keys — fetched by
kidfrom{SUPABASE_URL}/auth/v1/.well-known/jwks.jsonand cached forSUPABASE_JWKS_CACHE_SECONDS. An unseenkidtriggers a refetch, so key rotation needs no restart. - Algorithms —
ES256andRS256only. HS256 (legacy shared secret) tokens are rejected: enable asymmetric JWT signing keys in the Supabase project. - Claims —
exp,sub,aud(=SUPABASE_JWT_AUDIENCE, defaultauthenticated), andiss(={SUPABASE_URL}/auth/v1) are required. - Identity —
submust be a UUID. It becomesAuthUser.id(along with optionalAuthUser.email), bindsuser_idto the request logging context, and scopes user-specific database queries.
get_current_user runs verification in a worker thread.