Skip to main content

Function Signature

Description

A broadcast stream on Portal that emits when the backend rejects the Client Auth session Portal was initialized with: a 401 on a request that carried the session token, or an MPC operation whose authentication failed. The user has to sign in again.
  • It emits at most once per session. Afterwards, Portal calls fail with SESSION_INVALIDATED until initialize(session:) runs with a new session.
  • It is not emitted by clearSession, and never for a Portal initialized with an API key.
  • Portal() is a singleton, so the stream carries across initialize calls. Subscribe once, before the first initialize(session:). A broadcast stream does not replay, so a listener added after the event never sees it.
The SDK deletes the persisted session when it emits, unless a newer sign-in has already replaced it. Do not call clearPersistedSession in response: it deletes whatever is stored, including that newer session. Still handle errors from the call that failed: the stream tells you the session ended, not which operation failed. Available starting from portal_flutter 2.0.0.

Parameters

This property takes no parameters.

Returns

Stream<void> - Emits once when the session is invalidated.

Example

Errors

This property does not throw.