API referenceauth
ovok_sdk.auth.session
The signed-in user's session and its JSON conversions.
- Stable unknown
- Release candidate since 0.1.0-rc.4
- Development since 0.1.0-dev.25+2ba84b0
The signed-in user's session and its JSON conversions.
OvokReference
OvokReference(reference: str, display: str | None = None)A FHIR reference to a resource.
Attributes
| Name | Type | Description |
|---|---|---|
reference | str | Relative reference, such as Patient/123. |
display | str | None | Human-readable label, when the API sends one. |
Session
Session(
access_token: str,
refresh_token: str | None,
expires_at_ms: int,
project: OvokReference,
profile: OvokReference,
)The signed-in user's tokens, project and profile.
Attributes
| Name | Type | Description |
|---|---|---|
access_token | str | Bearer token; never shown in repr. |
refresh_token | str | None | Token that renews the session, if any; never shown in repr. |
expires_at_ms | int | Access-token expiry in epoch milliseconds. |
project | OvokReference | The project the user signed in to. |
profile | OvokReference | The user's profile resource, such as a Patient or Practitioner. |
is_stale_at()
is_stale_at(now_ms: int) -> boolWhether the access token is within a minute of expiring at now_ms.
session_from_login()
session_from_login(tokens: Mapping[str, Any], now_ms: int) -> SessionBuild a session from a sign-in response.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
tokens | Mapping[str, Any] | The camelCase body every Ovok sign-in route answers with. | |
now_ms | int | Current time in epoch milliseconds. |
Returns
Session: The new session.
session_after_refresh()
session_after_refresh(session: Session, response: TokenResponse, now_ms: int) -> SessionReturn session with the tokens from a refresh, keeping the old refresh token if none came back.
reference_from_json()
reference_from_json(value: Mapping[str, Any]) -> OvokReferenceRead a reference from its FHIR JSON shape.
reference_to_json()
reference_to_json(reference: OvokReference) -> dict[str, Any]Write a reference in its FHIR JSON shape.
Last updated on