Link

Token Object

class sanic_jwt.extended.tokens.Token

An object to hold token data(both encoded string and decoded data)

This object has no public methods.

β“… raw_jwt: str

  • An encoded raw jwt string

β“… raw_data: Dict[str, Any]

  • A decoded raw jwt data

β“… type: str

  • Type of token. access or refresh

β“… role: Optional[str]

  • Role of token. None if token has no role

β“… fresh: Optional[bool]

  • A boolean that represents freshness of token

β“… identity: str

  • The identity of token. alias of sub

β“… iss: Optional[str]

  • The issuer of token

β“… sub: str

  • A subject of token

β“… aud: Optional[str]

  • An audience of token

β“… exp: Optional[datetime.datetime]

  • A expiration of token

β“… nbf: datetime.datetime

  • Not valid before

β“… iat: datetime.datetime

  • Issued At

β“… jti: uuid.UUID

  • A unique value(uuid) of token

β“… public_claims: Dict[str, Any]

  • Public claims

β“… private_claims: Dict[str, Any]

  • Private claims

async def revoke

A classmethod to revoke specific token. revoked token will be stored to designated blacklist.

Parmeters

  • token required - A token object to revoke

Signature of Token

class Token:
    raw_jwt: str
    raw_data: Dict[str, Any] = ...
    type: str = ...
    role: Optional[str] = ...
    fresh: Optional[bool] = ...
    identity: str = ...
    iss: Optional[str] = ...
    sub: str = ...
    aud: Optional[str] = ...
    exp: Optional[datetime.datetime] = ...
    nbf: datetime.datetime = ...
    iat: datetime.datetime = ...
    jti: uuid.UUID = ...
    public_claims: Dict[str, Any] = ...
    private_claims: Dict[str, Any] = ...
    async def revoke(self, token: Token): ...