Skip to content

CIMD rejects clients that advertise a supported fallback auth method #6278

Closed

Description

@jhrozek

Summary

Our CIMD path rejects any client metadata document that declares a token_endpoint_auth_method other than none, and never looks at the token_endpoint_auth_methods_supported list the client publishes alongside it. ChatGPT publishes both — and the list includes none, which we support — so we reject a client we could serve.

Evidence

ChatGPT's live client document:

$ curl -s https://chatgpt.com/oauth/IbUR3zxyNQ16/client.json
{
  "client_id": "https://chatgpt.com/oauth/IbUR3zxyNQ16/client.json",
  "redirect_uris": ["https://chatgpt.com/connector/oauth/IbUR3zxyNQ16"],
  "token_endpoint_auth_method": "private_key_jwt",
  "token_endpoint_auth_methods_supported": ["none", "private_key_jwt"],
  "jwks_uri": "https://chatgpt.com/oauth/jwks.json",
  "grant_types": ["authorization_code", "refresh_token"]
}

It is telling us it can fall back to none. We never read that field.

Where

pkg/authserver/storage/cimd_decorator.go:

if m := doc.TokenEndpointAuthMethod; m != "" && m != defaultCIMDTokenEndpointAuthMethod {
    return nil, fmt.Errorf("%w: CIMD document at %s claims token_endpoint_auth_method %q "+
        "but this server only supports %q", ...)
}

private_key_jwt != none, so this returns invalid_client at /oauth/authorize. And cimd.ClientMetadataDocument in pkg/oauthproto/cimd/fetch.go has no field for token_endpoint_auth_methods_supported at all, so the negotiable list is invisible to us even if we wanted it.

Suggested fix

Add TokenEndpointAuthMethodsSupported []string to ClientMetadataDocument, then negotiate instead of asserting: use the declared method if we support it; otherwise pick the first entry from the supported list that we support; otherwise reject with the current error. That field exists in the metadata registry precisely for this.

Roughly ten lines plus tests. It is a negotiation fix, not a concession to a broken client.

Why this matters more than it looks

The MCP authorization spec (2026-07-28) deprecates DCR in favour of CIMD:

Dynamic Client Registration is deprecated. New implementations should use Client ID Metadata Documents instead.

with client priority: pre-registration → CIMD → DCR → prompt the user. OpenAI's own docs say ChatGPT prefers CIMD, and we already advertise client_id_metadata_document_supported, so ChatGPT will take this path.

The same bug has bitten at least two other projects: cloudflare/workers-oauth-provider#293 and Altinity/altinity-mcp#118, both blocking ChatGPT dev-mode apps for the identical reason.

Optional follow-on

If ChatGPT ever declines the none fallback, supporting private_key_jwt for CIMD clients is a smaller job than it sounds — fosite handles the assertion verification, pkg/oauthproto/cimd/fetch.go already permits asymmetric methods, and the JTI replay store (ClientAssertionJWTValid / SetClientAssertionJWT) is already implemented on both storage backends. The gap is jwks/jwks_uri fields on the document and wiring them to the fosite client. Worth a separate issue if it comes up.

Found while working on #5321 / #6252, which turns out not to address ChatGPT at all — that PR is about DCR, and ChatGPT's blocker is here.

Activity

  1. added
    needs-triage
    on Aug 10, 2026
  2. alex-feel commented on Aug 20, 2026

    @alex-feel
    Contributor

    Confirmed this reproduces on current main with the document shape live clients (ChatGPT) actually send: a singular token_endpoint_auth_method this server doesn't support, alongside a plural token_endpoint_auth_methods_supported list that does include a supported method — and the server rejects without ever reading the plural list.

    Opened #6400 implementing the negotiation you suggested above: add the plural field to the CIMD document struct, then prefer the declared singular method when supported, otherwise fall back to a mutually supported method from the plural list, otherwise reject with the existing error. This follows the same "a CIMD document describes capability across every AS it talks to" reading already used for the grant_types/response_types filtering on these documents.

    Two boundaries worth flagging for review: it's a pure widening (nothing accepted today becomes rejected), and the server's supported-method set intentionally stays independent of whatever the discovery endpoint advertises, since discovery may legitimately advertise methods CIMD documents are never allowed to declare.

    Happy to adjust the shape if you'd prefer a different approach.

  3. removed
    needs-triage
    on Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions