Acting for a user
How a product's own settings screen reads and writes a person's notify preferences, subscriptions, devices and inbox without the person ever touching notify.
A product keeps its own settings screen. Its customers never see notify. Behind that screen the product's API calls notify as the person, with a token it obtained for them — and notify knows which product is behind the call, so it shows and touches only that product's slice.
This is the platform's standard way for one service to act for a user. Nothing about it is notify-specific except which scopes exist.
How a product gets the token
RFC 8693 token exchange against auth.xeonr.io. The product's API holds the
person's access token from the request it is serving, and exchanges it:
POST https://auth.xeonr.io/api/v1/oauth/token
grant_type=urn:ietf:params:oauth:grant-type:token-exchange
subject_token=<the person's access token, as presented to you>
subject_token_type=urn:ietf:params:oauth:token-type:access_token
client_id=<notify's delegation client>
scope=notify:preferences:read notify:preferences:editThe response is a short-lived access token with the person as sub, your
client in act.sub, https://notify.xeonr.io in aud, and only the scopes
you asked for. No refresh token: re-exchange from the live session when it
expires.
Auth will only issue it when:
- every requested scope was in the person's original grant — so your
sign-in must request them (see below). A session that predates that is
invalid_scopeuntil the person signs in again; - every requested scope is delegatable — only the tier below is;
- notify's delegation client lists your client as an allowed delegator. Ask platform operations to add it; it is one row.
Do the exchange in your API, not in the browser. Never forward the person's original token to notify: it is audienced to your product and will be refused.
The delegatable scopes
| Scope | Reaches |
|---|---|
notify:preferences:read / edit | ListMyPreferences, SetMyPreference, ClearMyPreference |
notify:subscriptions:read / edit | ListMySubscriptions, Subscribe, Unsubscribe |
notify:endpoints:read / edit | GetPushConfig, ListMyDevices, RegisterDevice, UnregisterDevice |
notify:inbox:read / edit | ListInbox, UnreadCount, MarkRead |
notify:discord:read / edit | GetMyDiscordLink, SetMyDiscordLink, ClearMyDiscordLink |
Ask for the narrowest set each screen needs. Nothing else on notify is
delegatable: topics, keys, credentials, templates, publishing, and the person's
own delivery addresses, Discord link and blocked addresses are all first-party
and answer permission_denied to a delegated token however it was scoped.
What a delegated call sees
The same RPCs, confined:
- Preferences — the grid is your product's rows only. Writes must name your
app_slug; the person's blanket rows (app_slugempty) and other products' cells are refused. Resolved cells still inherit from the wider rows, because that is the answer your switches actually produce. - Subscriptions — only topics your product minted. You cannot subscribe somebody to a personal topic or another product's stream.
- Devices — a device registered through a delegated token lands in your
app's bundle (
delivery_appis set for you, and must match if you send it), and you list and remove only those. - Inbox — only your product's messages. "Mark everything read" marks your product's rows.
- Discord DMs — you cannot call
LinkDiscord; that reads the person's Xeonr connections with their token. Instead, read their Discord connection yourself (auth'sListConnections, as the person, withauth:connections:read) and hand notify the id throughSetMyDiscordLink. Notify verifies it: auth's publicLookupUsersByConnectionmust say that Discord id belongs to the very account the token names, or the call is refused. So the person links Discord once, on their Xeonr account at/account/link/discord, and your screen only ever points notify at it.
Every row written this way records your client as the actor, and is stamped as managed by your product — permanently: the stamp is set when the row is created and never changes. A delegated call that tries to edit or remove a row another product manages is refused.
Migrating rows you already hold
A product that already stores notification preferences has rows for people who
are not signed in. There is no token to exchange for them, so there is a
separate path, deliberately not the one above: ImportPreferences, called as
your service account under notify:preferences:import. It takes the
person's URN and a list of cells, writes them under your application's slug —
never a slug you choose — and is idempotent, so a re-run is safe. It is for a
one-shot backfill; a request handler that reaches for it instead of acting for
the person is misusing it.
ImportEndpoints is the same for devices, under notify:endpoints:import: the
push endpoints you already hold for a person, registered to your application's
bundle, idempotent on (person, install id). Imported rows are managed by your
product like delegated ones.
Removing what you created
When a person leaves your product, ReconcileManaged tears down what your
product created for them — subscriptions, devices, preference cells and the
Discord link stamped as managed by you — with no person present. Call it as your
service account under notify:managed:reconcile with the person's URN. Which
product's rows it reaches is read from your service account, never sent, so you
can only ever remove your own; whatever the person or another product created is
untouched. It is idempotent: a second call deletes nothing.