Skip to content

Exceptions

fastauth.exceptions.FastAuthError

Bases: Exception

Base exception for all FastAuth errors.


fastauth.exceptions.ConfigError

Bases: FastAuthError

Raised when the :class:~fastauth.config.FastAuthConfig is invalid.

Common causes: missing secret, no providers configured, or a session_strategy="database" without a session_backend.


fastauth.exceptions.MissingDependencyError

Bases: FastAuthError

Raised when an optional dependency is not installed.

FastAuth uses optional extras (jwt, oauth, sqlalchemy, etc.). This error tells you exactly which package to install and which extra to use.

Parameters:

Name Type Description Default
package str

The missing Python package name.

required
extra str

The FastAuth extra that includes the package.

required

fastauth.exceptions.AuthenticationError

Bases: FastAuthError

Raised when authentication fails.

Covers bad credentials, expired tokens, revoked sessions, and similar scenarios where the identity of the requester cannot be confirmed.


fastauth.exceptions.UserAlreadyExistsError

Bases: FastAuthError

Raised when attempting to register an email address that is already taken.


fastauth.exceptions.UserNotFoundError

Bases: FastAuthError

Raised when a user lookup returns no result.


fastauth.exceptions.InvalidTokenError

Bases: FastAuthError

Raised when a token is invalid, expired, or has been revoked.


fastauth.exceptions.ProviderError

Bases: FastAuthError

Raised when an auth provider returns an error.

Typically wraps OAuth provider failures (bad code, revoked tokens, etc.).