OAuth: client_credentials configuration results in authorization_code flow #4420

Open
opened 2026-02-16 17:43:44 -05:00 by yindo · 1 comment
Owner

Originally created by @thaoula on GitHub (Jan 8, 2026).

Originally assigned to: @thdxr on GitHub.

Description

Hi Team,

According to you docs we should be able to connect MCP's using pre-registered clients -
https://opencode.ai/docs/mcp-servers/#pre-registered

I have applied the following configuration

"saas-context": {
      "type": "remote",
      "url": "https://sass/mcp/context",
      "enabled": true,
      "oauth": {
        "clientId": "CLIENT_ID",
        "clientSecret": "CLIENT_SECRET",
        "scope": "jobs:read"
      }
    }

The requests appear to be going here -

Path Excluded: /public/public-api/mcp/context
Path Excluded: /.well-known/oauth-protected-resource/api/mcp/context
Path Excluded: /.well-known/oauth-protected-resource
Path Excluded: /.well-known/oauth-authorization-server/api/mcp/context
Path Excluded: /.well-known/oauth-authorization-server
Path Excluded: /oauth2/authorize

This opens a browser to do a authorization_code flow but it should do client_credential flow because clientId and clientSecret is provided.

Regards,
Tarek

Plugins

No response

OpenCode version

1.1.6

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

macOS 26

Terminal

vscode

Originally created by @thaoula on GitHub (Jan 8, 2026). Originally assigned to: @thdxr on GitHub. ### Description Hi Team, According to you docs we should be able to connect MCP's using pre-registered clients - https://opencode.ai/docs/mcp-servers/#pre-registered I have applied the following configuration ``` "saas-context": { "type": "remote", "url": "https://sass/mcp/context", "enabled": true, "oauth": { "clientId": "CLIENT_ID", "clientSecret": "CLIENT_SECRET", "scope": "jobs:read" } } ``` The requests appear to be going here - ``` Path Excluded: /public/public-api/mcp/context Path Excluded: /.well-known/oauth-protected-resource/api/mcp/context Path Excluded: /.well-known/oauth-protected-resource Path Excluded: /.well-known/oauth-authorization-server/api/mcp/context Path Excluded: /.well-known/oauth-authorization-server Path Excluded: /oauth2/authorize ``` This opens a browser to do a authorization_code flow but it should do client_credential flow because clientId and clientSecret is provided. Regards, Tarek ### Plugins _No response_ ### OpenCode version 1.1.6 ### Steps to reproduce _No response_ ### Screenshot and/or share link _No response_ ### Operating System macOS 26 ### Terminal vscode
yindo added the bugdocs labels 2026-02-16 17:43:44 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 8, 2026):

This issue might be related to existing OAuth/MCP authentication issues. Please check:

  • #5444: MCP with oauth doesn't work - discusses OAuth configuration issues with MCP servers
  • #5953: Reauthentication with Jira MCP via Oauth doesn't work - related to MCP OAuth flow problems
  • #5766: OAuth uses wrong authorization URL and missing redirectUri config - discusses OAuth flow implementation issues with enterprise auth servers

The core issue here is that when clientId and clientSecret are provided, the client_credentials OAuth flow should be used instead of the authorization_code flow. These related issues may contain useful context about MCP OAuth handling.

Feel free to ignore if your specific case differs from these issues.

@github-actions[bot] commented on GitHub (Jan 8, 2026): This issue might be related to existing OAuth/MCP authentication issues. Please check: - #5444: MCP with oauth doesn't work - discusses OAuth configuration issues with MCP servers - #5953: Reauthentication with Jira MCP via Oauth doesn't work - related to MCP OAuth flow problems - #5766: OAuth uses wrong authorization URL and missing redirectUri config - discusses OAuth flow implementation issues with enterprise auth servers The core issue here is that when `clientId` and `clientSecret` are provided, the client_credentials OAuth flow should be used instead of the authorization_code flow. These related issues may contain useful context about MCP OAuth handling. Feel free to ignore if your specific case differs from these issues.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4420