#3611·fumadocs

[Feature][OpenAPI] Configurable OAuth `redirect_uri` / single callback page for the playground

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

What problem will this feature address?

For the implicit and authorization code flows, the playground always sets redirect_uri to window.location.href (openapi/src/playground/auth.tsx:60). So every operation page sends a different redirect URI, including any query string or hash. Most OAuth providers only accept redirect URIs that are registered ahead of time, often as exact matches. Anyone trying the API from the docs would have to register every operation page's URL.

Pointing the redirect at one URL isn't possible today. The code exchange and the token live on the page that started the flow: AuthProvider reads ?code=/state on load and keeps the token in React state only.

Describe the solution you'd like

  • An option such as playground.oauth.redirectUri (a string, or a function of the current page), sent as redirect_uri.
  • When it's set, a small exported callback handler for that route. It completes the exchange (or hands code/state back to the page that started the flow, for example via sessionStorage or a postMessage from a popup) and returns the user to the original page with the token set.

Describe alternatives you've considered

  • Registering every operation page as a redirect URI works, but it isn't practical for large APIs.
  • Replacing the auth provider isn't enough, because the redirect URI is set inside the dialog. We'd have to replace the dialog too, and it depends on internal state that isn't exported.