Using API paths that differ from OAuth discovery paths (e.g., requesting /api/v1/data but OAuth is at /)
The OAuth server is on a different domain than your API requests
You want to ensure consistent OAuth behavior regardless of request URLs
For MCP transports, set baseUrl to the same URL you pass to the transport constructor.
Note: This wrapper is designed for general-purpose fetch operations.
MCP transports (SSE and StreamableHTTP) already have built-in OAuth handling
and should not need this wrapper.
Creates a fetch wrapper that handles OAuth authentication automatically.
This wrapper will:
The baseUrl parameter is optional and defaults to using the domain from the request URL. However, you should explicitly provide baseUrl when:
For MCP transports, set baseUrl to the same URL you pass to the transport constructor.
Note: This wrapper is designed for general-purpose fetch operations. MCP transports (SSE and StreamableHTTP) already have built-in OAuth handling and should not need this wrapper.