Skip to content

Sessions

Signing a person in, and what the project says about each person - their session's length, their claims, and whether they may still be signed in.

Read from the code itself, so it never falls behind it. The descriptions are the code's own, in English.

start_session

start_session(response: ResponseT, person: Any, *, request: HttpRequest | None = None) -> ResponseT

Sign person in on response: a new pair, in both cookies.

request, when given, travels with session_started.

issue_tokens

issue_tokens(person: Any, *, request: HttpRequest | None = None) -> Tokens

Sign person in for a native client: a new pair, and nothing set.

request, when given, travels with session_started.

Tokens dataclass

Tokens(access: str, refresh: str, lifetime: timedelta)

A pair for one person, and how long their session lasts.

mint

mint(person: Any) -> Tokens

A new pair for person, with their claims and their lifetime - and no signal.

lifetime_for

lifetime_for(person: Any) -> timedelta

How long a session of person's lasts - the project's answer, or simplejwt's.

add_claims

add_claims(token: Token, person: Any) -> None

Put the project's claims about person on token.

may_sign_in

may_sign_in(person: Any) -> bool

Whether person may still hold a session: active, and whatever the project adds.

person_of

person_of(refresh: RefreshToken) -> Any

The person refresh was issued to, or None when there is nobody.