Skip to content

Codex mcp login fails with OAuth providers that require resource (eg. MarketingCloud MCP) #12589

Closed as not planned

Description

@mishapavlov1

What variant of Codex are you using?

App and CLI

What feature would you like to see?

Bug: codex mcp login fails with OAuth providers that require resource (MarketingCloud MCP)

Summary

codex mcp login marketingcloud-mcp starts an OAuth PKCE flow, but the generated OAuth requests appear to omit the resource parameter required by the provider.

  • Without resource on the authorization request, the provider rejects the request.
  • If I manually add resource to the authorization URL, browser login succeeds, but the CLI then fails on token exchange (which also appears to omit resource).

This looks like a bug/compatibility gap in MCP OAuth handling for providers that require OAuth resource indicators.

Environment

  • codex-cli 0.104.0
  • macOS arm64
  • Date observed: 2026-02-23

MCP Server Config

  • Name: marketingcloud-mcp
  • URL: https://shared.marketingcloudmcp.com/mcp

Steps To Reproduce

  1. Configure/register the MCP server (already configured in my case) with:
    • https://shared.marketingcloudmcp.com/mcp
  2. Run:
    • codex mcp login marketingcloud-mcp
  3. Open the browser authorization URL printed by Codex.

Expected Behavior

The OAuth login completes successfully and codex mcp login marketingcloud-mcp stores credentials.

Actual Behavior

Authorization step fails (CLI-generated URL)

Provider returns:

{"error":"invalid_request","error_description":"Missing or invalid response_type, client_id, redirect_uri, PKCE (code_challenge), or resource required","error_uri":"https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-13#section-3.1.1"}

The CLI-generated authorize URL included PKCE params, client_id, and redirect_uri, but did not include resource.

Manual workaround partially succeeds, then token exchange fails

If I manually add:

  • resource=https://shared.marketingcloudmcp.com/mcp

to the authorization URL, the browser flow proceeds correctly.

After completing login in the browser, the waiting CLI process fails with:

Error: failed to handle OAuth callback

Caused by:
    OAuth token exchange failed: Server returned error response: invalid_request: Missing or invalid grant_type, code, redirect_uri, client_id, PKCE (code_verifier), or resource required (see https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-13#section-3.1.3.1)

This suggests the token request also omits resource.

Workaround

Partial only:

  • Manually patch the browser authorization URL to include resource=https://shared.marketingcloudmcp.com/mcp.

This gets past authorization, but the CLI still fails during token exchange.

Additional Notes

  • codex mcp list showed marketingcloud-mcp auth as Unsupported in my environment, even though codex mcp login attempted OAuth.
  • OAuth authorization server metadata is available at:
    • https://app.marketingcloudmcp.com/.well-known/oauth-authorization-server

Possible Cause / Suggested Fix (Hypothesis)

It looks like codex mcp login may not currently support OAuth providers that require a resource parameter (resource indicator).

One possible fix:

  • Support an MCP OAuth resource value per server config (or infer it when available), and
  • Include the same resource in both:
    • authorization request
    • token request

Additional information

No response

Activity

  1. added
    enhancement
    on Feb 23, 2026
  2. added
    bug
    CLI
    mcp
    auth
    on Feb 23, 2026
  3. github-actions commented on Feb 23, 2026

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

  4. removed
    enhancement
    CLI
    on Feb 23, 2026
  5. mishapavlov1 commented on Feb 23, 2026

    @mishapavlov1
    Author

    @etraut-openai it looks like a PR was made to address an earlier bug ticket but that didn't actually resolve issue

    #11292

    A user suggested a fix after issue was closed, pasted below

    #11292 (comment)

    Fix is available upstream

    "This was fixed in rmcp v0.16.0 (released today) via modelcontextprotocol/rust-sdk#651, which brings the SDK into compliance with the 2025-11-25 MCP auth spec including RFC 8707 resource parameter binding. Codex currently uses rmcp 0.15 (#11539) and just needs to bump to 0.16."

  6. etraut-openai commented on Feb 27, 2026

    @etraut-openai
    Contributor

    This will be addressed in the next release. The PR was based largely on a contribution from @xrmzju. Thanks!

  7. added a commit that references this issue on Feb 27, 2026
  8. bluedog13 commented on Mar 8, 2026

    @bluedog13

    I opened a PR for #13891 here: bluedog13#1

    Since this looks related, linking it here too for visibility.

  9. 1 remaining item

  10. jngiam commented on Apr 1, 2026

    @jngiam

    @etraut-openai this is still broken for me in the latest release. i noticed it marked as completed, is this to be fixed in a future release?

  11. etraut-openai commented on Apr 2, 2026

    @etraut-openai
    Contributor

    @jngiam, this bug was fixed in a previous version. If you're seeing something similar issue with the latest version, please open a new bug report and supply all of the information requested in the bug report template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug / regressionConnectorsCustomer blockedNext weekly reviewReliability & trustSource - Slackaffected: Instructureauthbugmcp

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions