Service contract: Google section gains the invite grant

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-11-29 20:45:04 +01:00
commit 8d350be506

View file

@ -236,10 +236,11 @@ Launch note:
implemented yet
- Repixelizer launch can configure Discord and Patreon on its provider buttons
### Google (OpenID Connect, link-only)
### Google (OpenID Connect, link-only; mints only under an invite grant)
`google` is an identity provider that never mints an account. It is a second
door into a person who already has one.
`google` is an identity provider that does not mint an account by itself. It is
a second door into a person who already has one, and a first door only for a
person an app has invited (see the invite grant below).
- Callback redirect URI (register exactly this in the Google Cloud OAuth
client): `{GC_ACCESS_BASE_URL}/v1/oauth/google/callback`, which is
@ -256,10 +257,23 @@ door into a person who already has one.
- `mode: "link"` needs `Authorization: Bearer <Heimdall access token>` for the
same app; the identity attaches to that token's account and to no other.
`mode: "sign_in"` signs in an account the `sub` is already linked to.
- A `sub` no account holds, arriving with `sign_in`, is refused and mints
nothing. A `sub` linked to another account is refused and never moved.
Both audit as `oauth_callback_failed` with error class `LinkRefusal`
and the code `identity_not_linked` or `link_initiator_mismatch`.
- A `sub` no account holds, arriving with `sign_in` and no invite grant, is
refused and mints nothing. A `sub` linked to another account is refused and
never moved. Both audit as `oauth_callback_failed` with error class
`LinkRefusal` and the code `identity_not_linked` or `link_initiator_mismatch`.
- Invite grant. An app whose profile sets `mayGrantFirstLogin` (only `bifrost`)
may start `mode: "sign_in"` with `firstLoginGrant: "invite"`, saying it has
invited this person. The start must carry that app's own secret; any other
caller, any other app, any other mode, or any other value is
`400 first_login_grant_refused` (a Bifrost start without the secret is still
`401 app_auth_required`). The grant rides only in the signed state
(`first_login_grant`), so nothing a browser sends can set it, and the state
stays single-use. At the callback a `sub` no account holds, under a grant,
mints one account with that identity linked, and audits
`account_minted_by_grant` with `{ provider, appSlug }`. A `sub` an account
already holds signs in to that account exactly as without a grant; the grant
never attaches an identity to an existing account and never moves one.
`mode: "link"` takes no grant and is unchanged.
- Link is two-phase. The callback verifies the identity and records a pending
link (TTL `completionTtlSeconds`), answering `status: "link_pending"` with a
`pendingLinkId` and no session; it writes no linked identity. The app calls