Providers¶
A provider is an authentication method. FastAuth routes a request to a provider by endpoint — each provider owns a slice of the /auth/* URL space.
Provider types¶
| Provider | id |
auth_type |
Routes | Extra needed |
|---|---|---|---|---|
CredentialsProvider |
credentials |
credentials |
/auth/register, /auth/login |
standard (argon2) |
MagicLinksProvider |
magic_links |
magic_links |
/auth/magic-links/login, /auth/magic-links/callback |
email (for SMTP) |
GoogleProvider |
google |
oauth |
/auth/oauth/google/* |
oauth (httpx) |
GitHubProvider |
github |
oauth |
/auth/oauth/github/* |
oauth (httpx) |
PasskeyProvider |
passkey |
passkey |
/auth/passkeys/* |
webauthn |
The presence of a provider in config.providers is what activates the corresponding routes:
CredentialsProviderenables the credentials routes (/auth/register,/auth/login,/auth/verify-email,/auth/forgot-password,/auth/reset-password). Without one,/auth/registerreturns400 Credentials provider is not configured.MagicLinksProvidermounts the/auth/magic-links/*router (only mounted when at least one provider is an instance ofMagicLinksProvider, perapi/router.py).PasskeyProviderpluspasskey_adapter+passkey_state_storemounts the/auth/passkeys/*router.- Any OAuth provider (
GoogleProvider,GitHubProvider) plusoauth_adapter+oauth_state_storemounts the/auth/oauth/*router.{provider}in the URL is matched againstprovider.id.
Combining providers¶
You can — and usually should — use multiple providers at once. Registration account-linking across providers is handled by the OAuth adapter and the user-by-email lookup.
providers=[
CredentialsProvider(),
MagicLinksProvider(),
GoogleProvider(client_id=..., client_secret=...),
GitHubProvider(client_id=..., client_secret=...),
PasskeyProvider(rp_id="example.com", rp_name="My App", origin="https://example.com"),
],