Session body
rn_forge.auth.session_body
The /auth/session response body and the callback error codes.
CALLBACK_ERRORS = frozenset(get_args(CallbackError))
module-attribute
The members of :data:CallbackError.
CallbackError = Literal['access_denied', 'account_not_provisioned', 'login_failed']
module-attribute
The codes a failed login callback sends to the error route.
SessionBody(subject, provider, expires_at, roles=frozenset(), permissions=frozenset(), name=None, email=None, picture=None, attributes=dict[str, Any](), auth_time=None, amr=frozenset())
dataclass
The signed-in user as the SPA sees it.
Attributes:
| Name | Type | Description |
|---|---|---|
subject |
str
|
The internal account ID, never the external subject. |
provider |
str
|
ID of the provider that authenticated the session. |
roles |
frozenset[str]
|
Role names. |
permissions |
frozenset[str]
|
Permission keys. |
expires_at |
datetime
|
When the absolute timeout ends the session. |
name |
str | None
|
Display name. |
email |
str | None
|
Email address. |
picture |
str | None
|
Avatar URL. |
attributes |
Mapping[str, Any]
|
Application-defined values for the UI. |
auth_time |
datetime | None
|
When the user authenticated. |
amr |
frozenset[str]
|
How the user authenticated. |
build(session, context, *, name=None, email=None, picture=None)
classmethod
Combine a session, its authorization context and profile values.
to_json()
Return the camelCase wire body.
Datetimes are RFC 3339 UTC strings ending in Z. roles,
permissions and amr are sorted lists. name, email,
picture, authTime, attributes and amr are omitted when
absent or empty. Keys of attributes, at every depth, are converted
from snake_case to camelCase.