#3609·fumadocs

[Bug][OpenAPI] OAuth2 `clientCredentials` flow always sends client credentials in the body, with no HTTP Basic option

Author: mehnoorsiddiquiCreated Sep 29, 2026Updated Sep 29, 2026

To Reproduce

  1. Use an OAuth 2.0 client credentials flow:

    yaml
    components:
      securitySchemes:
        oauth:
          type: oauth2
          flows:
            clientCredentials:
              tokenUrl: https://auth.example.com/oauth2/token
              scopes: {}
  2. In the playground, click Authorize, enter a client ID and secret, and submit.

  3. Inspect the token request.

Current vs. Expected behavior

Current: The request always sends grant_type=client_credentials&client_id=…&client_secret=… in the form body. Authorization servers that only accept HTTP Basic client authentication (client_secret_basic, which RFC 6749 §2.3.1 says servers MUST support) reject it with invalid_client.

Expected: The same choice the password flow got in #3506: send the credentials in the body, or send Authorization: Basic base64(client_id:client_secret) and leave them out of the body.

Framework

Tanstack Start

Provide environment information

bash
Framework: TanStack Start 1.168.50 (@tanstack/react-router 1.170.33), Vite 8.2.2
Operating System:
  Platform: win32
Binaries:
  Node: 24.12.0
Relevant Packages:
  fumadocs-core: 16.15.15
  fumadocs-ui: 16.15.15
  fumadocs-mdx: 15.4.0
  fumadocs-openapi: 11.4.1
  react: 19.2.8
  react-dom: 19.2.8

Which area(s) are affected? (Select all that apply)

Integrations (e.g OpenAPI, Typescript DocsGen)

Additional context

Observed on the versions above. The same code is in fumadocs-openapi 12.0.4 and on dev as of 1bc5374; source paths are relative to packages/ on that commit.

In requestOAuthToken (openapi/src/playground/auth.tsx), the password branch checks clientAuth === 'header' (line 91), but the clientCredentials branch always calls body.set('client_id', …) and body.set('client_secret', …) (lines 98–100). In openapi/src/ui/playground/components/oauth-dialog.tsx, the Client Authentication selector renders only when type === 'password'. Reusing clientAuth in the clientCredentials branch, and showing the selector for that flow too, should cover it.