Skip to content

SessionState

SessionState = { status: "pending"; } | { refetching: boolean; status: "anonymous"; } | { refetching: boolean; session: SessionRef; status: "authenticated"; user: IdUser; } | { retryAfter?: number; status: "unavailable"; }

The session, as client.id.session and client.id.subscribe report it.

  • pending: not known yet. Wait; do not render the signed-out page, or a signed-in user sees it for a moment on every page load.
  • anonymous: the tenant answered, and nobody is signed in.
  • authenticated: the user and their session.
  • unavailable: no answer came back, for example on a network failure. It does not mean signed out.

A refresh keeps the current state with refetching: true; it does not return to pending.