#3610·fumadocs

[Bug][OpenAPI] Relative `tokenUrl` / `authorizationUrl` are not resolved against the server URL

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

To Reproduce

yaml
openapi: 3.0.3
info: { title: Repro, version: 1.0.0 }
servers:
  - url: https://api.example.com
components:
  securitySchemes:
    oauth:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: /v1/oauth2/token
          scopes: {}
security:
  - oauth: []
paths:
  /items:
    get:
      responses:
        '200': { description: OK }

Click Authorize in the playground and submit.

Current vs. Expected behavior

Current: The token request goes to /v1/oauth2/token on the docs site's own origin, not to https://api.example.com/v1/oauth2/token.

Expected: OpenAPI allows relative URLs here and resolves them against the Server Object ("Relative References in URLs": "Unless specified otherwise, all properties that are URLs MAY be relative references … Relative references are resolved using the URLs defined in the Server Object as a Base URL"). The playground should resolve tokenUrl, and authorizationUrl for the implicit and authorization code flows, against the selected server before using them.

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.

requestOAuthToken and AuthProvider (openapi/src/playground/auth.tsx, lines 77, 103 and 172) pass flow.tokenUrl / flow.authorizationUrl straight to fetch and window.location.replace. AuthProvider already sits inside ServerProvider (openapi/src/utils/create-page.tsx), so the selected server can be reached from there through useServer() (openapi/src/utils/use-server.tsx), for example as new URL(flow.tokenUrl, selectedServerUrl).