Security in FastAPI typically layers reusable dependencies: one validates the bearer token, another loads the user record, a third checks route-level scopes. That pattern reads cleanly in code review and maps well to OpenAPI’s security schemes.

Production habits
- Rotate signing keys and document how mobile and web clients refresh tokens; never ship long-lived opaque secrets in query strings.
- Log authentication failures with correlation IDs—without printing raw tokens or passwords.
- Pair JWT expiry with server-side revocation or short TTLs when you need immediate logout for admin roles.
When enterprises mandate full OIDC with their IdP, FastAPI often sits behind an API gateway or Envoy that validates tokens; your dependency then trusts forwarded claims only within a locked-down network path. Document that trust boundary for penetration testers.