From 1eb86ca624798e10a9786d3ba58bcd7abb43c92e Mon Sep 17 00:00:00 2001 From: Titus Date: Mon, 30 Nov 2026 22:20:45 +0100 Subject: [PATCH] Account tokens: an app's session ends when the password changes; not_reader's text The session header answers on the account routes only while it matches the stored password; the errors table follows the API document's text for not_reader. Co-Authored-By: Claude Opus 5.5 --- contract/error-codes.json | 2 +- src/content/docs/api/errors/index.mdx | 2 +- src/content/docs/docs/changelog.md | 1 + src/content/docs/docs/development/api/members.mdx | 2 +- src/content/docs/docs/getting-started/keys.md | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/contract/error-codes.json b/contract/error-codes.json index 81c0c56c..3f18a295 100644 --- a/contract/error-codes.json +++ b/contract/error-codes.json @@ -200,7 +200,7 @@ "not_reader": { "type": "permission_error", "status": 403, - "summary": "A key wrote a Read mark (a Relation whose supertype is Read, the message profile's record of what one reader has read) that is not its own, or a write would make someone else's Relation one: a Read mark is written only by the reader whose mark it is, the world's owner and its co-builders included. The reader adds to its own mark with POST /api/v2/account/worlds/{world_id}/read." + "summary": "A key wrote a Read mark (a Relation whose supertype is Read, the message profile's record of what one reader has read) that is not its own, or a write would make someone else's Relation one: a Read mark is written only by the reader whose mark it is, the world's owner and its co-builders included. The reader adds to its own mark with POST /api/v2/account/worlds/{world_id}/read. A mark whose maker is no longer a member of the world may be deleted by whoever may delete any Relation there." }, "narratives_only": { "type": "permission_error", diff --git a/src/content/docs/api/errors/index.mdx b/src/content/docs/api/errors/index.mdx index e30c9f9a..2d20c998 100644 --- a/src/content/docs/api/errors/index.mdx +++ b/src/content/docs/api/errors/index.mdx @@ -92,7 +92,7 @@ Each code belongs to one family, its `type`, and a family's codes do not share o | [`use_not_granted`](#use_not_granted) | `permission_error` | `403` | An AI door token called a use it was not minted for (`param` use): it opens only the uses it names. Mint one that names this use, or call with an account credential. Nothing was counted. | | [`write_not_granted`](#write_not_granted) | `permission_error` | `403` | A sign-in at the MCP server (an app connected with Sign in with OnlyWorlds) tried to write, and that sign-in was not granted Read and write, or its writing was stopped. Nothing was written. To let the app write, disconnect it on your account page, connect it again and choose Read and write. Served only as the text of an MCP tool's error, never as an HTTP status. | | [`not_author`](#not_author) | `permission_error` | `403` | A contributor or guest key changed, replaced, relinked or deleted an element someone else created. | -| [`not_reader`](#not_reader) | `permission_error` | `403` | A key wrote a Read mark (a Relation whose supertype is Read, the message profile's record of what one reader has read) that is not its own, or a write would make someone else's Relation one: a Read mark is written only by the reader whose mark it is, the world's owner and its co-builders included. The reader adds to its own mark with POST /api/v2/account/worlds/\{world_id\}/read. | +| [`not_reader`](#not_reader) | `permission_error` | `403` | A key wrote a Read mark (a Relation whose supertype is Read, the message profile's record of what one reader has read) that is not its own, or a write would make someone else's Relation one: a Read mark is written only by the reader whose mark it is, the world's owner and its co-builders included. The reader adds to its own mark with POST /api/v2/account/worlds/\{world_id\}/read. A mark whose maker is no longer a member of the world may be deleted by whoever may delete any Relation there. | | [`narratives_only`](#narratives_only) | `permission_error` | `403` | In a world where AI seats propose and a person accepts, an AI seat sent its own Read mark more than its list of read messages, and nothing was written: a PATCH or a link edit takes only `narratives`, a PUT of an existing mark only a change to `narratives`, and a new mark only `narratives` with the name and the Character the message gives. | | [`hidden_not_allowed`](#hidden_not_allowed) | `permission_error` | `403` | A create (POST, a PUT of a new id, a /bulk item that creates) carried `hidden: true` from a key that may not hide: only the world's owner and its co-builders (person or seat) may. Nothing was created. Leave `hidden` out, or ask a keeper. | | [`keeper_only`](#keeper_only) | `permission_error` | `403` | A key that is not a keeper's (a contributor's, a guest's or a seat's below co-builder) set, changed or removed `x_charter_of` on an element of any type (the mark that makes a Charter, a Guide or a Domain the world's reading aid); or changed, relinked or deleted a Law that carries it or an Object such a Law's text names, its own included; or added a file to such an element or removed one from it; or created an Object under an id such a text names. Nothing was written. `keeper_only` never refuses the owner's own keys or a co-builder's; sending the mark unchanged passes. | diff --git a/src/content/docs/docs/changelog.md b/src/content/docs/docs/changelog.md index 87580f5f..abe1d099 100644 --- a/src/content/docs/docs/changelog.md +++ b/src/content/docs/docs/changelog.md @@ -9,6 +9,7 @@ What changed on onlyworlds.com for everyone is on its own [Changelog](https://ww ## 2026-11-30 +- **[Account tokens](/docs/getting-started/keys#account-tokens): an app's session ends when the password changes.** An `X-Session-Token` answers on the account routes only while it matches the account's stored password: after a password change or reset it is a `401` `invalid_credentials`, and the app signs in again. An account token (`ow_a_`) is not affected. - **[Godot](/docs/development/godot) [0.17.0](https://github.com/OnlyWorlds/godot-sdk/releases/tag/v0.17.0), [Unity](/docs/development/unity) [0.61.5](https://github.com/OnlyWorlds/unity-sdk/releases/tag/v0.61.5) and [Unreal](/docs/development/games) [0.18.0](https://github.com/OnlyWorlds/unreal-sdk/releases/tag/v0.18.0): the world folder writers follow the folder format's 0.3.26 rules.** An element's id is checked as `.json` whatever its name, so an element named Bob with the id `con` is refused, and a folder is stamped `format_version` 0.3.26; a folder stamped 0.3.25 is read as before. Godot and Unreal word the archive's refusals as the TypeScript SDK does and add the name check for one name (`OWWorldArchive.segment_fault`, `OnlyWorlds::OWWorldArchive::SegmentFault`). - **[TypeScript](/docs/development/typescript#world-files) [4.227.1](https://www.npmjs.com/package/@onlyworlds/sdk) and [Python](/docs/development/python) [0.160.1](https://pypi.org/project/onlyworlds/): a name that holds half of a surrogate pair is refused.** The world file's name check, and so the folder writers' id check and the packers, refuse a name or an id that is not well-formed Unicode, as the [folder format](/docs/schema/folders#rules-for-tools) now says. No archive name can carry one: before, the TypeScript packer wrote such an id under another name, and two such ids beside each other as two entries of one name, which its own reader then refused. A whole emoji passes as before. - **[World folders](/docs/schema/folders#rules-for-tools): how a writer names and refuses element files, written down (folder format 0.3.26, schema-dist serial 150).** The page now gives the [id tail](/docs/schema/folders#layout) in code points with its nine cases, the ids a writer does not write whatever the name, and what happens when two file names are one once folded; schema-dist holds the cases in `fixtures/folder-writer/`. [TypeScript](/docs/development/typescript#world-files) [4.227.0](https://www.npmjs.com/package/@onlyworlds/sdk) and [Python](/docs/development/python) [0.160.0](https://pypi.org/project/onlyworlds/) stamp a new folder `0.3.26` and run those cases; their writers already kept the rules. A folder stamped 0.3.25 is read as before. diff --git a/src/content/docs/docs/development/api/members.mdx b/src/content/docs/docs/development/api/members.mdx index 01ffbe86..22484eb3 100644 --- a/src/content/docs/docs/development/api/members.mdx +++ b/src/content/docs/docs/development/api/members.mdx @@ -196,7 +196,7 @@ A client can do the same two steps itself: | Method | Route | What it does | |:--|:--|:--| | POST | `/api/v2/join/preview` | `{"code"}`: who invites you, the world, the role, `reader` (`person`), `expires_at`, `note`, the inviter's note or `null`, `character_name` (since 2026-11-27: the name of the Character the link names for you, when joining now would set it, else `null`; read again at every preview, shown as text), and [`glimpse`](#the-glimpse). No credential; the code stays unused | -| POST | `/api/v2/account/join` | `{"code"}`, with an account credential (`Authorization: Bearer ow_a_…`, or the `X-Session-Token` of a signed-in app client): `201` with the new membership (the same body as accepting an invite) | +| POST | `/api/v2/account/join` | `{"code"}`, with an account credential (`Authorization: Bearer ow_a_…`, or the `X-Session-Token` of a signed-in app client, until the account's password changes): `201` with the new membership (the same body as accepting an invite) | A code made for a person is a bad code for an AI agent, and the other way round: every bad code, whatever the reason, answers the same `404`. diff --git a/src/content/docs/docs/getting-started/keys.md b/src/content/docs/docs/getting-started/keys.md index 1b36a8fd..06b81308 100644 --- a/src/content/docs/docs/getting-started/keys.md +++ b/src/content/docs/docs/getting-started/keys.md @@ -131,7 +131,7 @@ curl -s "https://www.onlyworlds.com/api/v2/account/worlds" \ -H "Authorization: Bearer ow_a_…" ``` -An app signed in through the login API (`/api/v2/auth/app/v1/auth/login`) may send its `X-Session-Token` on any account route in place of the token; an unknown or expired one is a `401`. A page on onlyworlds.com signed in with the site's own session cookie sends the `csrftoken` cookie's value in the `X-CSRFToken` header on every write, or the write is a `403` [`csrf_required`](/api/errors/#csrf_required) and nothing is written; a token or an `X-Session-Token` needs none. +An app signed in through the login API (`/api/v2/auth/app/v1/auth/login`) may send its `X-Session-Token` on any account route in place of the token; an unknown or expired one is a `401`, and so is one made before the account's password was last changed or reset (`invalid_credentials`, since 30 Nov 2026): the app signs in again. A page on onlyworlds.com signed in with the site's own session cookie sends the `csrftoken` cookie's value in the `X-CSRFToken` header on every write, or the write is a `403` [`csrf_required`](/api/errors/#csrf_required) and nothing is written; a token or an `X-Session-Token` needs none. ### Reading a world with an account token