Skip to content

Blacklisted Token

This model stores the blacklisted JWT token after user logged out. It will be automatically cleared out at a configurable interval to keep the performance optimised.

Bases: Base

Blacklisted token model

Source code in FasterAPI\models.py
class BlacklistedToken(Base):
    """Blacklisted token model""" ""

    __tablename__ = "blacklisted_tokens"
    id: Mapped[int] = mapped_column(primary_key=True, index=True)
    token: Mapped[str] = mapped_column(unique=True, index=True)
    exp: Mapped[datetime]

__tablename__ = 'blacklisted_tokens' class-attribute instance-attribute

exp: Mapped[datetime] instance-attribute

id: Mapped[int] = mapped_column(primary_key=True, index=True) class-attribute instance-attribute

token: Mapped[str] = mapped_column(unique=True, index=True) class-attribute instance-attribute