Player identity
Every request your game makes carries the player’s game ticket. Spawnle knows who the player is from it, so your game never shows a login screen and never handles passwords.
The player
Section titled “The player”const { user } = await Spawnle.init();
user.handle; // "sofi_moth" — unique, stable, safe to use as an iduser.displayName; // "Sofi" — what to show; falls back to the handleuser.avatarUrl; // picture URL, or nulluser.avatarColor; // "#9b8cff" — background behind the initial when there is no pictureuser.level; // the player's Spawnle leveluser.studio; // { id, name, title, color } — the studio badge they wear, or nullOver REST: GET /v1/sdk/me.
Use handle to key anything you store about a player on your own servers.
Display names can change and are not unique.
What a ticket is
Section titled “What a ticket is”A ticket (gt_…) is a random token the launcher gets from the API right
before starting your game:
- It belongs to one player and one game.
- It lasts 24 hours.
- It opens only the SDK routes (
/v1/sdk/…). It cannot read the player’s messages, friends list, email or library, nor change anything on the account. - Changing the account’s password ends it immediately.
The launcher only gives tickets for games in the player’s library (or to the game’s own developer).
Proving identity to your server
Section titled “Proving identity to your server”A player could send your server any name. To know who is really connected, have the game send its ticket and let your server ask Spawnle — see Server verification.
socket.send(JSON.stringify({ type: "hello", ticket: spawnle.ticket }));