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.

Initiates a device-code sign-in flow. Returns a user code and QR code immediately. Display these to the user on the device. They scan the QR or enter the code on another device to authorize. The SDK polls in the background and completes sign-in automatically.

Parameters

NameTypeRequiredDescription
pollIntervalMs / pollIntervalSecondsnumberNoHow often to poll for authorization (default: 5000ms / 5s).
timeoutMs / timeoutSecondsnumberNoMaximum time to wait for authorization before giving up (default: 600000ms / 600s).

Returns

DeviceCodeResult — An object containing userCode (short code for display), qrCode (base64 data URL), deviceCode (internal), and expiresIn (seconds).

Example

const client = new DiscovrClient("your-client-id");
const { userCode, qrCode } = await client.signInWithDeviceCode();
console.log("Code:", userCode);
// Render qrCode in your UI

client.onAuthStateChanged(({ signedIn }) => {
  if (signedIn) {
    console.log("User authorized! Proceed with profile selection.");
  }
});