Skip to content

Guest seats from invite links, with tokens scoped to one table

Context and problem

Eduardo decided on 2026-11-25 (#255) that people without an Apple or Google account can still sit down: a host’s invite link gives them a seat at that table and nothing else, rematches included, until the table closes or the host removes them. Typed codes keep needing an account, so the guessing defences keep their per-account budgets. A guest must be a real users row, so that #262 can later let them keep their games. The server issues its own tokens (0003), so the question was how a token says “one table only” and how the server keeps to it.

Options considered

  1. A claim in the access token, checked again in the database. The token carries guest (the table id); every route reads it, and the hello and redemption also read the user’s row.
  2. A separate guest token type with its own key and verifier. Two token paths to keep pinned, for no gain over a claim the same key signs.
  3. Database checks only. Every HTTP route would need a query to learn what the token could say for free, and a route that forgets one is open.

Decision

We chose option 1.

  • POST /auth/guest {"token", "displayName"} takes a table link’s token and a name under the PATCH /me rules. It makes a users row with guest_table set and no identity, a chosen profile name, and seats them through the table’s task as any link does. A group link, a used token or a typed code makes no guest.
  • The access token’s guest claim names the table. Table, invite and /me/tables routes refuse it (403 guestNotAllowed); /me and DELETE /account accept it. The hello refuses another table, and reads the row: a guest whose session ended gets guestEnded and close 4410, final. Redemption refuses a guest by the row, whatever the token says.
  • The session ends when the host sends remove, the guest leaves or signs out, their refresh token lapses, the game ends (the save that records the result), or the last player with an account leaves a lobby. Their refresh tokens are revoked. A guest never takes the host role.
  • Limits: HOMEFELT_GUESTS_PER_TABLE (3) live guests per table, and guests count in the same per-IP hourly budget as sign-ups (HOMEFELT_SIGN_UPS_PER_IP).
  • Retention: a guest with no identity is deleted HOMEFELT_GUEST_DAYS (30) after the session ended, as DELETE /account deletes an account: within about 60 days of a guest’s last play, since an unused refresh token lapses after 30. The privacy page says so. Eduardo confirmed the defaults (3 guests, 30 days) on 2026-11-26, and that guests ship for one game now, with a rematch at the same table as a later issue.

Consequences

Good

  • One token verifier and one key; scope is enforced where the token is read, and revocation where the row is read.
  • #262 only adds an identity and clears guest_table.

Bad

  • An access token outlives a removal by up to 15 minutes on /me; the hello and redemption read the row, so no seat or new table comes of it.
  • There is no rematch on the server yet: a guest keeps the seat across the hands of one game, and a later rematch has to keep the table open (not finished) for its guests to stay.

More information

  • Issues: #255, #262, the apps #258 and #259.
  • spec/protocol/server.md “Join as a guest”; docs/server.md “Guests”.