Skip to content

Customization

FastAPI FullAuth is pluggable, not prescriptive. Almost every part can be swapped or extended without forking the library. This page is the map of every customization seam, with a link straight to the relevant guide.

  • Your own database

    Implement the adapter interface for MongoDB, Tortoise, DynamoDB, or any store. Writing a custom adapter has a complete worked example.

  • Custom user fields

    Extend UserSchema / CreateUserSchema with your own columns and control which ones PATCH /me may touch. See Custom schemas.

  • Token claims

    Embed your own data in the JWT (tenant id, plan, feature flags) with a claims builder. See Custom token claims.

  • Event hooks

    Run your code after register, login, verify, password reset, and more. See Event hooks.

  • Password rules

    Plug in your own validation, strength rules, or hashing scheme. See Password validation.

  • Token transport

    Switch between bearer headers and httponly cookies, or run both. See Cookies and Frontend integration.

  • Which routes mount

    Mount the combined router or pick individual sub-routers, and change the URL prefix. See Getting Started and Architecture.

  • Login field

    Authenticate by username (or any field) instead of email by overriding get_user_by_field. See Writing a custom adapter.

  • Everything else

    Token lifetimes, lockout, rate limits, CSRF, security headers, and storage backends are all configurable. See Configuration.

How extensibility works

Two mechanisms cover most of the surface:

  • Adapters and mixins. The adapter is the database seam. Inherit an optional mixin (roles, permissions, OAuth, passkeys, sessions) and the matching router mounts automatically; leave it out and the feature is simply absent - no dead endpoints. See adapter architecture.
  • Configuration and hooks. FullAuthConfig tunes behavior declaratively, while event hooks and token claims let you inject code at the right moments without subclassing the routers.

Worked combinations

The Recipes page ties these seams together in complete, copyable examples - a multi-tenant SaaS (custom field + claims + dependency) and username-based login, among others.

If something isn't covered here, the API reference lists every public type, and the architecture overview explains how the layers fit together.