How do I add usernames and player sign-in to my AI game?
On Cassette, your players already have accounts. They sign in with email, Google or Apple on Cassette’s own sheet and pick a @username, and your game reads who is playing in one line. No sign-up form, no passwords, no player emails to look after.
Tell your agent
Let players sign in on cassette.gg and show their username in my game.- Who is playing
- cassette.player is { id, username }, or null for a guest. The id is the player’s id in your game.
- One call to sign in
- cassette.signIn() opens Cassette’s sign-in sheet, and the game hears when a player signs in or out.
- Their saves follow
- A guest’s progress moves to their account the first time they sign in, if the account has no save for the game yet.
- Your own server too
- A game with its own backend checks who is playing with a signed token and Cassette’s public keys.
Read the player, and ask a guest to sign in:
const cassette = await Cassette.ready
cassette.player // { id, username } or null
cassette.on('player', (p) => updateHud(p)) // signed in or out
if (!cassette.player) await cassette.signIn() // Cassette's sign-in sheetWho is playing, for agents (§2)The player on your own server