Skip to content

feat: sign in to a server as yourself with zitadel login, for the CLI and MCP clients - #2451

Closed
fforootd wants to merge 37 commits into
claude/apps-model-25449cfrom
claude/poc-platform-oauth-415a8f
Closed

fforootd wants to merge 37 commits into
claude/apps-model-25449cfrom
claude/poc-platform-oauth-415a8f

Conversation

@fforootd

@fforootd fforootd commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Summary

Zitadel's own OAuth for the zitadel CLI and MCP clients, built to work the way a customer's authorization server will (ADR 081, ADR 082, the identity model): the platform project is a project like any other, so an agent using Zitadel's API or MCP server follows the same rules as any app. It began as a proof of concept, whose findings set the plan below. It was built out in steps, all of which are in.

Stacked on #2452 (stack #2694): this PR's base is #2452's branch, whose apps, client registrations and AppDirectory the last step reads.

What the branch does now:

  • Authorization server (apps/api/internal/oauth, behind platform.oauth.enabled). The issuer is server.public_base's origin, the domain the console shares with the server, under ADR 081 §5's new carve-out for the platform project. RFC 8414 metadata sits at the root and under /oauth/{project_id}/, and RFC 9728 metadata sits at each API's path (/.well-known/oauth-protected-resource/api/v1). zitadel/oidc's op.Server answers token, revoke and JWKS; authorize and registration stay ours, because its authorize path has no resource, no iss on errors, and renders errors it should redirect.
  • Sign-in and consent through the console's <zitadel-login> (ADR 081 §8–§11), the way a customer's login app will answer its own authorization server:
    • Authorize checks the request, seals it into an opaque handle and sends the browser to <console>/login?auth_request=<handle>. A cookie set for each request binds it to that browser.
    • The widget sends the handle on POST /flow. The flow keeps the request in its sealed cookie, so there is no auth_requests table; the worst case fills 3.3 KB of the cookie's 4 KiB, and a test holds it there.
    • The flow ends in a redirect to the client with code, state and iss (or the error), whatever its definition's terminal step says. The widget first exchanges the handoff, so the console keeps the session.
    • A third-party client, or prompt=consent, gets the reserved consent step after the sign-in: the client's name, the host it returns to, the API and a line per scope, with Allow and Deny.
    • A browser already signed in to the console is answered at once, under the consent step when one is needed. prompt=login signs in again, and prompt=none never shows a step.
    • Flow definitions can no longer name a step consent or account_choice. The POC's server-rendered consent page and its /login?next= route are gone.
  • Clients and APIs from feat: add apps with their OAuth clients and APIs, and zitadel apps create #2452's AppDirectory, the way a customer's authorization server will find them. The zitadel app is a built-in app the directory serves beside the platform project's stored apps: client cli (public, first party, loopback on any port), APIs platform (aud = <base>/api/v1) and mcp, and registration through client ID metadata documents and RFC 7591.
    • POST /register writes a client registration (dcr_…) instead of a sealed client id. Its first authorization request joins it to the app whose API it names, and it is held to that app. The consents implement ClientRegistrationConsents: a live consent keeps a registration past its hour, and deleting one deletes its consents and their tokens.
    • A client gets the APIs and scopes its document lists, a third party an API open to third parties; its consent policy and grant_types decide the consent step and the grants.
    • A request names its API as resource, and a scope the API does not define is invalid_scope, as agreed with feat: add apps with their OAuth clients and APIs, and zitadel apps create #2452. Confidential clients wait for client authentication at the token endpoint.
  • Tokens: JWT access tokens with one audience each (RFC 8707). Codes and rotating refresh tokens are sealed, single use, and revoked on replay.
  • Signing keys (ADR 082 §7): access tokens are signed RS256, or ES256 for an API that chooses it. A project holds one active signing key per algorithm (new migrations in all three dialects); it is still created with an EdDSA key only, and the RS256 or ES256 key is minted the first time a token or the JWKS needs it. The JWKS lists the RS256 and ES256 keys, RS256's from before the first token, and may be cached for five minutes.
  • Consents (new consents table, all three dialects): one per user, client and API, stored like a session. A third-party client asks again only for a scope the user has not agreed to, or on prompt=consent. The CLI is never asked but gets one too, so it shows among the user's connected apps. A consent lasts platform.oauth.consent_lifetime (90 days) at most, and ends sooner when its refresh token goes unused. Revoking it ends every token issued under it; signing out on one machine ends only that sign-in.
  • Me endpoints: GET /users/me/consents and DELETE /users/me/consents/{consent_id}, with consent.given and consent.revoked audit events.
  • No redirect before the user has seen the app: until the user has seen a registered client's consent step, its errors show the error page (or flow.auth_request_invalid in the login) instead of going to a non-loopback redirect URI (RFC 9700 §4.11.2).
  • A person's token everywhere a secret goes, but the app plane. The spec names the project secret as its own scheme, pat, and oauth2 becomes the platform project's authorization code flow: a person's token, acting with their grants (ADR 053 §5). Every operation that takes pat takes oauth2 too, except the app plane (auth attempts, challenges, handoffs, session create and exchange, the claim, passkey registration); a test walks the spec to hold that. Both schemes read Authorization: Bearer, so each handler skips the other's tokens. For a person, POST /projects/query lists the projects they may act on. The generated Go client's SecuritySource gains Pat.
  • /mcp: a Streamable HTTP stub with a whoami tool; it answers 401 with resource_metadata.
  • CLI: zitadel login, whoami and logout, which find the server from the API's RFC 9728 metadata. Every project command then acts as the developer, unless the run names a secret: a secret in the process environment, --env-file or a non-development environment's files wins; then the sign-in; then the secret setup stored (.env.local, .env.development.local, .zitadel/secret, which setup all writes). --credential project|login forces one, the envelope's credential names it, and a refused credential is never retried with the other. preview and claim keep the secret. zitadel api calls what a person's token may call as the developer.

Validation

  • go test ./... in apps/api, and the SQLite lane (go test -tags sqlite_integration ./...), after every commit.
  • Postgres: internal/storage/stmttest and the API integration suite, against a local Postgres 18 (ZITADEL_TEST_POSTGRES_URL).
  • moon run server:lint server:vet server:format server:openapi, and moon run server:check-generate-pruned on its own.
  • The CLI unit suite (vitest run in apps/cli) and moon run workspace:check -- --only release.
  • moon run components:test components:typecheck api-mock:test api-mock:typecheck console:test console:typecheck storybook:typecheck storybook:test config:test sdk-core:test sdk-core:typecheck and those projects' lint; then moon run components:build e2e:demo-next-mock e2e:demo-nuxt-mock.
  • By hand, against a server built from the branch (console embedded, OAuth, CIMD and dynamic registration on), in a browser:
    • zitadel login with the console already signed in: straight back to the CLI, signed in as the operator.
    • zitadel login with prompt=login: the email and password steps, then POST /sessions/exchange, then back to the CLI.
    • A dynamically registered client asking for the MCP server: the consent step; Allow returns a code that exchanges for an MCP-audience token and a refresh token; the same scopes again skip the step; a new scope asks again, and Deny returns access_denied with state and iss.
    • A handle that is not valid here shows "This sign-in link expired or was opened in another browser", and GET /users/me/consents lists the CLI and the agent.
  • By hand, the CLI as the developer against a built server: projects list (the developer's project, not the platform's), deployment list, events list and variable list with credential: login, a variable written with the stored token, --credential login over a secret in the environment, --credential project with none (the error names the variable), and the token refused on createAuthAttempt (401).
  • moon run cli:typecheck cli:lint cli:test (6,039 tests), go test ./... and the SQLite lane, go vet on every build tag, moon run docs:typecheck docs:lint.
  • Signing keys: the new stmttest suites (one active key per algorithm, ListSigningKeys) on SQLite and Postgres 18, the key service's minting and race, and the token endpoint, JWKS and Verify for RS256, ES256 and forged tokens.
  • After merging feat: add apps with their OAuth clients and APIs, and zitadel apps create #2452's branch: go test ./..., the SQLite lane and go vet on every tag; moon run server:generate api:generate cli:typecheck cli:lint cli:test api:test api:typecheck config:test config:typecheck docs:typecheck docs:lint docs:generate. Two CLI proxy tests timed out minting their certificate under the full run and passed on their own.
  • The app directory: the OAuth server's SQLite suite (registration, join, refused API and scopes, deleting a registration, a consent keeping one through the purge), the Go unit and SQLite lanes, and on a local Postgres 18 internal/storage/... and internal/api/integration_test/... (835 tests).
  • Not run: the Spanner lane (no Docker here; CI runs it), and Claude Code against this version.

Release notes / changeset

  • .changeset/platform-oauth-login.md (@zitadel/cli minor, @zitadel/server minor): zitadel login, whoami and logout, every project command as the developer and --credential, the platform project's authorization server behind platform.oauth.enabled with sign-in through the console, RS256 access tokens and a cacheable JWKS, consents and their lifetime, and the two me endpoints.
  • .changeset/login-consent-step.md (@zitadel/components, @zitadel/sdk-core, @zitadel/config, @zitadel/api, @zitadel/server, all minor): <zitadel-login> answers an authorization request, with its consent step; client on zitadel-flow-step and on flow responses; the reserved step names.
  • .changeset/api-person-token.md (@zitadel/server, @zitadel/api, minor): a person's token on every operation but the app plane, the pat scheme beside oauth2 (the Go client's SecuritySource gains Pat), login in the operation list, a person's projects.

Notes

🤖 Generated with Claude Code

fforootd and others added 8 commits October 28, 2026 16:03
POC for platform-project OAuth: authorization codes and refresh tokens are
single-use records in the tokens table (oidc_access_token rows keyed by
the grant in oidc_session_id), so a consume must report whether it found
the row, and reuse detection revokes the whole grant.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An OAuth 2.1 authorization server for the platform project, behind
platform.oauth.enabled: one app declared in code (the CLI as a public
first-party client, the platform API and /mcp as its APIs, client ID
metadata documents and stateless dynamic registration for MCP clients),
EdDSA JWT access tokens with one audience each (RFC 8707), rotating
refresh tokens with reuse detection, sign-in through the console's
login, a minimal consent page for third parties, and an /mcp stub with
a whoami tool. The API takes the access token as ADR 053 §5's user
bearer on the operations a console session may call, and getMyUser
accepts it.

A proof of concept to learn from, not a merge candidate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…erver (POC)

zitadel login signs a developer in to a server with the authorization
code flow, PKCE (S256) and a loopback redirect on a free port, after
discovering the platform API's protected-resource metadata and its
authorization server's metadata. The tokens live in the CLI's user
config directory, owner-only. whoami asks GET /users/me with the
token; logout revokes the refresh token and forgets the sign-in.

deployment list falls back to the developer's sign-in when no project
secret resolves, acting as the developer through ADR 053's grants.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Unit tests for the POC's protocol rules at the lowest layer that holds
them: PKCE and redirect matching in internal/oauth, the user bearer's
principal in the security handler, the code exchange, audience and
refresh rotation against a real SQLite database, and the CLI's loopback
sign-in and token store against a fake authorization server. SKILL.md
and the command reference describe login, whoami and logout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What the POC built and ran end to end (the CLI and Claude Code against
one built-in app), what worked, what was missing, and what the identity
model in #2445 got right or wrong.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
v4 lost codes through a loopback redirect check that decoded
redirect_uri twice and redirected to the once-decoded value. Here the
request decodes it once and ParseRedirectTarget parses it once, and the
value must now be its own canonical form with no '#' at all, so the URL
checked is byte for byte the URL the browser is sent to. Tests cover
v4's payload encoded once and twice, the redirect's Location, and the
payload joins the shared redirect-target corpus.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ly spec on one

getMyUser now also takes the platform access token, so the api spec's
example of an operation only a session authenticates is getMySession.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cloud Error Error Nov 6, 2026 10:53am UTC

Request Review

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

🦋 Changeset detected

Latest commit: 4b55f9e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 24 packages
Name Type
@zitadel/server Minor
@zitadel/api Minor
@zitadel/components Minor
@zitadel/sdk-core Minor
@zitadel/config Minor
@zitadel/cli Minor
@zitadel/sdk-angular Minor
@zitadel/sdk-next Minor
@zitadel/sdk-nuxt Minor
@zitadel/sdk-qwik Minor
@zitadel/sdk-qwik-router Minor
@zitadel/sdk-react Minor
@zitadel/sdk-solid Minor
@zitadel/sdk-solid-start Minor
@zitadel/sdk-svelte Minor
@zitadel/sdk-sveltekit Minor
@zitadel/sdk-tanstack-start Minor
@zitadel/sdk-vue Minor
@zitadel/testing Minor
@zitadel/server-linux-x64 Minor
@zitadel/server-linux-arm64 Minor
@zitadel/server-darwin-x64 Minor
@zitadel/server-darwin-arm64 Minor
@zitadel/server-win32-x64 Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment thread apps/api/internal/oauth/clients.go Fixed
Comment thread apps/api/internal/oauth/respond.go Fixed
fforootd and others added 6 commits October 29, 2026 07:24
…rom the console's domain

The platform project's issuer is now the domain the console is served on,
which it shares with the server in the cloud and on a self-hosted server.
Its metadata sits at that domain's root, and its endpoints stay under
/oauth/{project_id}/. ADR 081 §5 carves the platform project out of "the
server's own origin is never an issuer".

zitadel/oidc v3.51.16's op.Server now answers token, revocation and JWKS:
it routes them, parses forms and client credentials, and encodes errors.
Authorize stays this package's, since the library renders the errors
VerifyAuthRequest returns, leaves iss off its error redirects, and has no
resource parameter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main moved the Go module into apps/api (#2271), generates the API stubs
into apps/api/internal/api/generated (#2273), and returns a wrapped handler
from buildHTTPMux. So the oauth package moves to apps/api/internal/oauth,
and its routes mount inside buildHTTPMux behind the API's chain, which also
maps the loopback session cookie onto __Host-zitadel_session (#2488).

The CLI's login commands declare their next steps in the typed next field
(#2523), pass the command's abort signal to the API client, and keep no
sign-in when the CLI has no config directory. login, whoami and logout
follow main's skills in the Getting started group.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…een it

Dynamic registration and client metadata documents accept any https
redirect URI, and authorize sent some failures there before anyone signed
in, such as an unsupported response_type, or login_required for
prompt=none. That made the server a redirector for phishing
(RFC 9700 §4.11.2; CodeQL #41). Such a failure now goes back only to a
first-party client or a loopback URI, and the error page answers the rest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The API moved under /api/v1 (ADR 077), so the platform API's identifier,
the token's aud, is <base>/api/v1, and its protected-resource metadata
sits at /.well-known/oauth-protected-resource/api/v1 (RFC 9728 §3.1). The
CLI looks there and checks that the document names that resource
(RFC 9728 §3.3).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… identity model

ADR 081 §5's carve-out now names server.public_base's origin, so the
console's other origins (server.console_origins) never mint an issuer.
The POC findings link the identity model on main, call the records
consents, take the model's answer on how a registration finds its app,
drop the third row of server-declared apps now that the platform project
deploys a release, and list the cloud's vercel.json rules and the PAT
scheme among the follow-ups.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread apps/api/internal/oauth/clients.go Fixed
Comment thread apps/api/internal/oauth/respond.go Fixed
…evoke them

A consent records that a user let a client use some of an API's scopes
(ADR 082 §8). It is transient data stored like a session: a consents row in
the three dialects, whose deadline each use moves, never past
platform.oauth.consent_lifetime (90 days by default; ADR 072's model). The
codes and refresh tokens issued under it are tokens rows that name it as
their oidc_session_id, and it replaces the POC's grant ids.

- A third-party client is asked for consent again only for a scope the user
  did not agree to, or on prompt=consent. A first-party client is never
  asked, but gets a consent too, so the user sees it among connected apps.
- Revoking a refresh token (RFC 7009) ends that sign-in alone. A replayed
  code or refresh token revokes every token of its consent.
- GET /users/me/consents lists a user's live consents, newest first, and
  DELETE /users/me/consents/{consent_id} revokes one with its tokens, both
  on the session cookie.
- consent.given and consent.revoked are audit events, written in the
  transaction that gives or revokes the consent.
- A client_id longer than 1024 characters names no client, since a
  consent's unique key holds it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fforootd and others added 4 commits November 3, 2026 13:42
…nsent step

The authorization endpoint no longer signs the user in or renders consent
itself (ADR 081 §8–§11). It seals the validated request into an opaque
handle, binds it to the browser with a cookie of its own, and sends the
browser to the console's /login?auth_request=<handle>. POST /flow opens the
request with that cookie, and the flow answers it:

- It ends in a redirect to the client with the code, state and iss (or the
  error), whatever the definition's terminal step says, and keeps its
  handoff so the page keeps the session.
- A third-party client, or prompt=consent, gets the reserved consent step
  after the sign-in; accept and deny are its actions.
- A live session answers at once, under the consent step when needed and
  without a handoff; prompt=login signs in again, prompt=none shows no step.
- Flow definitions can no longer name a step consent or account_choice.

Every response of such a flow names the client. The POC's server-rendered
consent page, its POST /consent and the /oauth/continue route are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… its consent step

The widget reads ?auth_request= from the page URL and sends it as
auth_request_id on every POST /flow, restarts included (ADR 081 §8). A flow
that answers a request names its client on every response, which the
template context and zitadel-flow-step now carry.

- The consent step shows the client's name beside the host it returns to,
  the API it would call and a line per scope (a scope without a text shows
  its name), with Allow and Deny. Focus does not land on Allow by itself.
- Such a flow ends in a redirect to the client: the widget exchanges the
  handoff first, so the session stays on this origin, and navigates even
  when the exchange fails. Flows without a client redirect as before.
- flow.auth_request_invalid reads as the catalog's text.

The console's /login keeps auth_request in the URL and renders the widget for
a live session too, so the flow can answer for it (Console ADR 0003). The
mock API, the centered and minimal designs and Storybook learn the step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…auth-415a8f

# Conflicts:
#	apps/cli/src/lib/oclif/environment-command.ts
Comment thread apps/api/internal/oauth/respond.go Fixed
@peintnermax

Copy link
Copy Markdown
Member

I went through this against ADR 081/082, #1283 and the #1425 epic, and wrote up where it fits and where it differs: #2860 (the note).

Worth keeping as built: the authorize/back-channel split, the sealed request with a per-request binding cookie, consent as an engine-inserted step, one audience per token, and the redirect matcher.

Questions before this moves on:

  1. The server holds one project and one issuer. OAuth: per-project authorization server switch and metadata #2793 asks for the issuer and project from the request. Does that rework land here or in a follow-up?
  2. Requests without resource are refused, but the epic's first scope (a web app that only wants an ID token) names no API. What should they get?
  3. openid is in scopes_supported but no ID token is issued. Drop it until OIDC: ID token and discovery #2801?
  4. ADR 081 §8.3 wants one flow cookie per flow before the server ships. Can that come in here?
  5. ADR 082 §9 requires a login-only issuer for open registration. The issuer here is the console's origin. How do we meet that, on the cloud especially?
  6. Apps are read at their newest revision. OAuth: authorization endpoint #2794 seals the deployment in the flow. Same question as 1: here or later?
  7. Does the refresh path check that the user is still active?
  8. Three checks fail (gate-turbo, full-pr-turbo, Vercel). Known?

Separately: #2788 to #2801 describe much of what this PR and #2452 already built, under application names and for a confidential web app first. Whether these PRs become that implementation is a question for #2785.

A code exchange or a refresh read the user only to see whether they still
existed, so a user whose owning team was deactivated, and who can no
longer sign in, kept getting access tokens for as long as the consent
lived. Every status but active now ends the consent's tokens, as a deleted
user's already did.

The metadata also stops listing openid: the server issues no ID token yet
(#2801), and a client such as Claude Code asks for every scope listed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@peintnermax peintnermax left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review against the design note in #2860. I read the oauth package, the flow authorization code, the security handler, the consent service and the CLI's sign-in code. Storage dialects, widget and tests I did not read line by line, and nothing below was reproduced by running it.

What I'd keep as it is: the redirect matcher, the sealed request with its per-request binding cookie, PKCE checked before the code is redeemed (so a replay without the verifier revokes nothing), the kind and project checks in unseal, and refresh checking that the user is still active (that answers my earlier question 7).

Bugs worth fixing before this moves on

  1. Concurrent CLI refresh signs the developer out everywhere. developerAccessToken (apps/cli/src/lib/login/flow.ts) has no lock. Two commands running in parallel both present the same refresh token; the second is treated as a replay and every token of the consent is revoked. Agents run commands in parallel, so this will happen. A lock file around the refresh, or a short grace window for the previous token on the server, would close it.
  2. A metadata-document outage is answered as invalid_client. documentCache.load wraps a failed fetch as errUnknownClient, so a refresh from a CIMD client fails with 401 while the client's host is briefly down, and the client drops its token. internal/AGENTS.md asks that "could not decide" never becomes a refusal. Serving the stale entry on a failed refetch would do.
  3. The refresh token is rotated before the access token is minted (issueTokens). A failure after Rotate answers 500 with the old token already spent; the retry then revokes the whole consent. Mint first, or do both in one step.
  4. The metadata-document cache is unbounded, and failures are not cached. An unauthenticated /authorize with an https:// client_id triggers a fetch each time. It needs a size bound, a negative cache and a per-host limit before the switch is turned on anywhere public.
  5. Narrowing the scope on a refresh is permanent. issued.Scope = requested also goes into the rotated refresh token. RFC 6749 §6 keeps the refresh token's scope; only the access token should narrow.
  6. An oversized state still reaches handOff. The length check runs late, and its own failure path passes the long state on, so the handle and the flow cookie exceed what a browser keeps. Check it first and drop it from the error hand-off.
  7. Any 4xx on refresh deletes the stored sign-in in the CLI, a 429 or invalid_target included. Only invalid_grant should.
  8. Binding cookies accumulate on Path=/ for ten minutes per request and are cleared only when a flow terminates. Repeated requests can push headers over limits on the console's origin. A narrower path, or a cap, would help.
  9. The CLI accepts a callback without iss although the metadata advertises it. RFC 9207 §2.4 wants it refused.
  10. Redirect targets are re-parsed with url.Parse in authorize.go and re-encoded with Query().Encode(), where internal/AGENTS.md asks for httputil.ParseRedirectTarget only. The re-encoding also means the browser is not sent byte for byte to the checked URL when a registered URI has a query.

Design points, from #2860

  • One project. Server holds one project id, one issuer and the console path, and /mcp sits in the same package. #2793 asks for the issuer and project from the request.
  • Scopes are not enforced on the platform API. HandleOAuth2 builds the scope context from the user alone; UserBearer carries no scope. Fine while only the CLI gets these tokens, but it has to change before a third party does.
  • resource is required, which the epic's first scope cannot satisfy.
  • openid is advertised with no ID token.
  • Open registration on the console's origin conflicts with ADR 082 §9's login-only rule. I'd keep both switches off until that is settled.
  • The first-party skip. With a live console session, any page can navigate the browser into issuing a code for cli to a loopback port with no interaction. A consent once per device would close it.

Happy to go through any of these on a call.

fforootd and others added 2 commits November 6, 2026 02:26
From the review of #2451:
- A client ID metadata document whose host cannot answer is served as it
  was last read, for up to an hour; without one the answer is 503, never
  invalid_client, so a client keeps its tokens. A refusal is remembered
  for a minute, concurrent requests share one fetch, and the cache holds
  1,024 documents, 32 per host.
- A refresh mints the access token and resolves the sealing key before it
  spends the refresh token, so a failed answer leaves the client a token
  to retry with, not a replay that ends the consent.
- Narrowing the scope on a refresh narrows the access token only; the
  next refresh token keeps the scope it had (RFC 6749 §6).
- An oversized state is checked first and left out of the error, so
  neither the handle nor the flow's cookie carries it.
- A browser with five unfinished requests has their binding cookies
  cleared as the next one is set.
- Stored redirect URIs are parsed with httputil.ParseRedirectTarget only,
  and the answer's parameters follow the registered query, which is no
  longer decoded and encoded again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rant

From the review of #2451:
- Runs refresh a sign-in one at a time, under a lock file beside the
  stored sign-ins, and one that waited uses the token the run before it
  stored. Two agents' commands presented one refresh token at once, and
  the server read the second as a replay and revoked the consent.
- Only invalid_grant forgets the sign-in. A 429, invalid_target,
  invalid_client, a 5xx or no answer keeps it for a later run, and a 429
  is E_NETWORK, as a 5xx is.
- The callback must name the discovered issuer as iss when the metadata
  promises it, and an error from another issuer is not trusted either
  (RFC 9207 §2.4).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
return Client{}, errUnknownClient
}
req.Header.Set("Accept", "application/json")
resp, err := c.fetch.Do(req)
peintnermax added a commit that referenced this pull request Nov 6, 2026
A review against the issues, the ADRs and the code found claims that had
gone stale and contradictions that live in the ADRs and issues rather than
in the note. The note now:

- corrects the PKCE and iss conflict (only #2795 and the ADRs still
  require them), the library's authorize, and openid in #2451's metadata;
- lists six decisions with their owners: a stored issuer, the response to
  a request without resource, registration as a project switch, the sealed
  request as an ADR 081 amendment, prompt=login and max_age, and what must
  hold before the platform project's issuer goes on;
- moves the ID token and discovery into the first scope's server step and
  gates the platform project on those preconditions;
- adds the cloud origin shared with the website, the platform issuer
  following public_base, sign-out, audit, limits and key rotation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
peintnermax added a commit that referenced this pull request Nov 9, 2026
Consent is a step inside the one flow that answers the authorization
request, not a round trip of its own; the note now walks through it,
what a later request and a revocation do, and that #2451's step is all
or nothing. Stripe's MCP consent stands for the other design, a
per-resource selection, and what Zitadel would need for it. Open
question 12 asks whether a user may allow part of a request.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
peintnermax added a commit that referenced this pull request Nov 10, 2026
Name #2451's consent events and the gaps that remain, separate the
published test kit from the private API mock and its license, record
the agreed login approach in the first-scope steps, and make the audit
and limit criteria an explicit task of step 3.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@fforootd fforootd closed this Nov 16, 2026
@github-project-automation github-project-automation Bot moved this from Inbox to Done in Engineering Kanban Nov 16, 2026
fforootd pushed a commit that referenced this pull request Nov 30, 2026
The pieces a person's token on /mcp needs were built once in the closed
prototype #2451, are read against the epic in #2860, and public clients are
being built again in #3409.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137eGmVSt2DgYJj2CjZbi1U

This branch had an error being deployed

1 failed deployment
Preview — 4b55f9ed Deployed Nov 6, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants