createManagementAuth drops the custom fetch option from clientOptions

Open Beginner friendly
#1,432 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@RaphaelFakhri is already working on this.

Since Oct 22, 2026.

  • #1433 by @RaphaelFakhri — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
77/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
node.js, typescript

Research direction

Start by reading createManagementAuth and the ManagementClientOptions type, then compare how ManagementClient forwards fetch with how clientOptions is built. Add a focused test that supplies a custom fetch and checks it is retained and used by a sub-client; the issue gives no test file name, so locate the existing management auth tests. Done means sub-client requests use the supplied function.

Written by the indexing model from the issue text.

Description

Description

createManagementAuth accepts a fetch option (it is part of ManagementClientOptions), and TokenProvider uses it for the token request. The returned clientOptions does not include it, so sub-clients built with new UsersClient(auth.clientOptions) send every Management API request through the global fetch.

ManagementClient forwards fetch to the underlying client, so the two setups behave differently. The createManagementAuth docs state that clientOptions carries the same behaviour as ManagementClient.

This affects any setup that relies on a custom fetch: proxies, instrumented fetch, runtimes without a global fetch, and useMTLS, where the token is certificate-bound but API calls go out without the client certificate.

Reproduction
import { createManagementAuth } from "auth0/management";
import { UsersClient } from "auth0/users";

const myFetch: typeof fetch = (input, init) => {
    console.log("custom fetch", input);
    return fetch(input, init);
};

const auth = createManagementAuth({
    domain: "your-tenant.auth0.com",
    token: "your-api-v2-token",
    fetch: myFetch,
});

console.log(auth.clientOptions.fetch); // undefined
await new UsersClient(auth.clientOptions).list(); // "custom fetch" is never logged
Expected behaviour

auth.clientOptions.fetch is the supplied function, and sub-client requests use it, as with ManagementClient.

Environment
  • auth0 v7.6.0 (current master)
  • Node.js 22
Dominant language
TypeScript
Stars
683
Forks
319
Avg merge
1d 30m
Merged PRs (30d)
13

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from auth0/node-auth0

All issues in auth0/node-auth0

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.