Authenticate each route class
Every request resolves to one principal. Customer and operator browsers use server-side Auth0 sessions; agents use Auth0 access tokens; local development can enable explicit debug headers.Resolve principals in order
The API evaluates these credential types:- Local debug headers when
NEOBANK_DEBUG_AUTH_ENABLED=truein development or test - Agent OAuth bearer tokens
- Customer or operator session cookies
Authorization so OAuth-authenticated agents and server integrations can reach the API. Customer browser routes still require the customer session, origin check, and cross-site request forgery token.
Protect browser sessions
FastAPI completes the Auth0 Authorization Code flow with Proof Key for Code Exchange and stores an opaque session in Redis. Secure deployments use an HTTP-only__Host-neobank_session cookie.
Unsafe cookie-authenticated methods require both the exact Origin and the session’s X-CSRF-Token. Sensitive transfers, mandate changes, and card actions also consume a short-lived confirmation intent bound to the normalized payload.
Customer routes reject agents and operators. Operator routes use a separate Auth0 application and remain limited to view and suspend behavior.