codex - 💡(How to fix) Fix Codex Desktop MCP OAuth DCR registers fewer scopes than it later requests

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Codex Desktop fails OAuth login for a remote Streamable HTTP MCP server that supports Dynamic Client Registration (DCR).

The authorization server metadata advertises DCR and the following scopes:

{
  "issuer": "https://clerk.actionbook.dev",
  "authorization_endpoint": "https://clerk.actionbook.dev/oauth/authorize",
  "token_endpoint": "https://clerk.actionbook.dev/oauth/token",
  "registration_endpoint": "https://clerk.actionbook.dev/oauth/register",
  "scopes_supported": [
    "openid",
    "profile",
    "email",
    "public_metadata",
    "private_metadata",
    "offline_access"
  ],
  "code_challenge_methods_supported": ["S256"]
}

Codex Desktop appears to dynamically register an OAuth client without registering the same scopes that it later requests during the authorization step. The flow reaches the browser callback, but authorization fails with:

OAuth provider returned `invalid_scope`: The requested scope is invalid, unknown, or malformed. The OAuth 2.0 Client is not allowed to request scope `openid`.

The callback URL contains:

error=invalid_scope&error_description=The requested scope is invalid, unknown, or malformed. The OAuth 2.0 Client is not allowed to request scope `openid`.

Error Message

error=invalid_scope&error_description=The requested scope is invalid, unknown, or malformed. The OAuth 2.0 Client is not allowed to request scope openid.

Root Cause

Codex Desktop fails OAuth login for a remote Streamable HTTP MCP server that supports Dynamic Client Registration (DCR).

The authorization server metadata advertises DCR and the following scopes:

{
  "issuer": "https://clerk.actionbook.dev",
  "authorization_endpoint": "https://clerk.actionbook.dev/oauth/authorize",
  "token_endpoint": "https://clerk.actionbook.dev/oauth/token",
  "registration_endpoint": "https://clerk.actionbook.dev/oauth/register",
  "scopes_supported": [
    "openid",
    "profile",
    "email",
    "public_metadata",
    "private_metadata",
    "offline_access"
  ],
  "code_challenge_methods_supported": ["S256"]
}

Codex Desktop appears to dynamically register an OAuth client without registering the same scopes that it later requests during the authorization step. The flow reaches the browser callback, but authorization fails with:

OAuth provider returned `invalid_scope`: The requested scope is invalid, unknown, or malformed. The OAuth 2.0 Client is not allowed to request scope `openid`.

The callback URL contains:

error=invalid_scope&error_description=The requested scope is invalid, unknown, or malformed. The OAuth 2.0 Client is not allowed to request scope `openid`.

Code Example

{
  "issuer": "https://clerk.actionbook.dev",
  "authorization_endpoint": "https://clerk.actionbook.dev/oauth/authorize",
  "token_endpoint": "https://clerk.actionbook.dev/oauth/token",
  "registration_endpoint": "https://clerk.actionbook.dev/oauth/register",
  "scopes_supported": [
    "openid",
    "profile",
    "email",
    "public_metadata",
    "private_metadata",
    "offline_access"
  ],
  "code_challenge_methods_supported": ["S256"]
}

---

OAuth provider returned `invalid_scope`: The requested scope is invalid, unknown, or malformed. The OAuth 2.0 Client is not allowed to request scope `openid`.

---

error=invalid_scope&error_description=The requested scope is invalid, unknown, or malformed. The OAuth 2.0 Client is not allowed to request scope `openid`.

---

scope=openid profile email ...
RAW_BUFFERClick to expand / collapse

Description

Codex Desktop fails OAuth login for a remote Streamable HTTP MCP server that supports Dynamic Client Registration (DCR).

The authorization server metadata advertises DCR and the following scopes:

{
  "issuer": "https://clerk.actionbook.dev",
  "authorization_endpoint": "https://clerk.actionbook.dev/oauth/authorize",
  "token_endpoint": "https://clerk.actionbook.dev/oauth/token",
  "registration_endpoint": "https://clerk.actionbook.dev/oauth/register",
  "scopes_supported": [
    "openid",
    "profile",
    "email",
    "public_metadata",
    "private_metadata",
    "offline_access"
  ],
  "code_challenge_methods_supported": ["S256"]
}

Codex Desktop appears to dynamically register an OAuth client without registering the same scopes that it later requests during the authorization step. The flow reaches the browser callback, but authorization fails with:

OAuth provider returned `invalid_scope`: The requested scope is invalid, unknown, or malformed. The OAuth 2.0 Client is not allowed to request scope `openid`.

The callback URL contains:

error=invalid_scope&error_description=The requested scope is invalid, unknown, or malformed. The OAuth 2.0 Client is not allowed to request scope `openid`.

Expected behavior

Codex Desktop should keep the DCR registration request and the subsequent authorization request consistent.

If Codex Desktop later requests:

scope=openid profile email ...

at /oauth/authorize, then it should register the dynamic client with the same requested/allowed scopes at /oauth/register, or only request scopes that were successfully registered/allowed for that dynamic client.

Actual behavior

DCR succeeds far enough for Codex Desktop to proceed to authorization, but the dynamically registered OAuth client is not allowed to request openid. Codex Desktop then requests openid during authorization, causing the authorization server to reject the flow with invalid_scope.

Why this appears client-side

The same MCP server works with Claude against the same authorization server. In that flow, the DCR registration scopes and authorization request scopes are consistent.

This does not appear to be a case where the MCP server lacks DCR support. The problem is that Codex Desktop registration and authorization use inconsistent scope sets.

Environment

  • Product: Codex Desktop
  • MCP transport: Streamable HTTP
  • OAuth provider: Clerk OAuth with Dynamic Client Registration enabled
  • MCP URL: https://edge.actionbook.dev/mcp

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Codex Desktop should keep the DCR registration request and the subsequent authorization request consistent.

If Codex Desktop later requests:

scope=openid profile email ...

at /oauth/authorize, then it should register the dynamic client with the same requested/allowed scopes at /oauth/register, or only request scopes that were successfully registered/allowed for that dynamic client.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Codex Desktop MCP OAuth DCR registers fewer scopes than it later requests