Skip to content
Browse Docs and Help
how-to

Use sign-in and result sharing

Let the host handle identity and sharing without exposing player details.

On this page

Display a player name safely

After init, call player.isSignedIn() or player.name(). Treat the name as display text: it can change, may not be unique and may be null. Put it in text content, not HTML, identifiers, analytics or saves.

Subscribe to signedInChange and re-read the display name. Do not infer age, email or a persistent player id.

Offer sign-in

  1. Persist the progress you need before requesting sign-in.
  2. Call player.requestSignIn() from a suitable game action.
  3. Handle signedIn: false without blocking the free gameplay path.
  4. Expect that following the host’s login flow can replace the current frame rather than resolve the original promise.

Do not render your own password form inside the game.

Offer a result to share

import llvls from '@llvls/sdk';

async function offerResult(): Promise<void> {
  llvls.gameplayStop();
  const result = await llvls.share.result('I finished the maze');
  if (!result.shown) console.info('Result sharing is not available here');
}
void offerResult;

Call after initialisation and after a run has started. Integrate this with your actual break, not as a way to fake lifecycle.

The host adds the game URL and draws the Share control. shown: true means the control appeared, not that the player shared. Use 1 to 80 characters of plain text, with no links, addresses or control characters. Kids games and previews do not offer this result-sharing control.

Resume gameplay with gameplayStart() when the next run actually begins.