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.

You list profiles with getProfiles() for your “who’s watching?” UI, then select one with selectProfile() so the SDK mints a session JWT for that viewer. Session-tier endpoints (pages, rows, tailored lists) then follow that profile’s recommendation snapshot and library state.
Illustrative light-theme profile picker: profile tiles with avatars/names plus add-profile entry; APIs are getProfiles and selectProfile—your grid and copy may differ.
Example layout only—your tiles and “add profile” placement are yours; the getProfilesselectProfile sequence stays the same.

Build the flow

1

Ensure the user is signed in

Finish a sign-in flow from Authentication so the SDK holds a refresh token (isSignedIn() is true).
2

List profiles for the picker

Call getProfiles() (identity tier). Render each profile’s name and avatarUrl—for example as a horizontal row or grid with an optional “Add profile” tile that navigates to your create UI. Avatars may be image or MP4 URLs; use an image view, video/looping player, or a small wrapper that picks by URL or content type (see Managing profiles).
3

Handle zero profiles

If the list is empty, send users to your create-flow (see Managing profiles) and call createProfile() before returning here.
4

On selection, mint the session

When the user taps a profile, call selectProfile(profileId). You can use switchProfile() when swapping from another profile—the SDK rotates the session and recommendation snapshot.
5

Gate session-tier calls

Before createPage, list rows, or other session APIs, use hasActiveProfile() or getActiveProfileId() if you want a defensive check.
Subscribe to onAuthStateChanged() (or Kotlin authState / Swift authStateStream) to refresh chrome when profile changes or sign-out occurs. Subscribe to onSessionRefreshed() when you need to rebuild homepage data after snapshot turnover.

Example: list → select → first session API

const client = new DiscovrClient("your-client-id", {
	basePath: "https://api.discovr.media",
});

const { profiles } = await client.getProfiles();
const chosen = profiles[0]; // replace with tile the user tapped

await client.selectProfile(chosen.id);

if (!client.hasActiveProfile()) throw new Error("Session not ready");
const page = await client.createPage();