Skip to content

Models

Inherit this mixin to give your SQLAlchemy user model the columns CRUDAuth expects. If your table differs, satisfy the logical contract with column_map= instead.

crudauth.models.AuthUserMixin module-attribute

AuthUserMixin = make_auth_identity()

Default identity columns: email + username login, email recovery, oauth enabled.

Inherit this for the standard account shape (it is exactly make_auth_identity()):

class User(Base, AuthUserMixin):
    __tablename__ = "users"
    full_name: Mapped[str | None] = mapped_column(default=None)

token_version is a monotonic credential epoch: bearer tokens embed it as the ver claim and a password reset bumps it, so a reset rejects every outstanding bearer token.