Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.discovr.media/llms.txt

Use this file to discover all available pages before exploring further.

Subscribes to authentication state changes (sign-in, profile switch, sign-out). Fires immediately with current state, then again on every change. Use this to update your UI’s logged-in state and profile display.

Parameters

NameTypeRequiredDescription
cb (TypeScript)callbackYesFunction called with { signedIn, profileId } whenever auth state changes.

Returns

Unsubscribe — Function to call when you’re done listening. (TS only; Kotlin/Swift use Flow/AsyncStream lifecycle.)

Example

const unsubscribe = client.onAuthStateChanged(({ signedIn, profileId }) => {
  if (signedIn) {
    console.log("Signed in, profile:", profileId);
  } else {
    console.log("Signed out — show login screen");
  }
});
// Cleanup: unsubscribe();