createManagementAuth drops the custom fetch option from clientOptions
Maintainers usually reply within 1 day
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
- Domain
- backend-api-design
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
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from auth0/node-auth0
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 70/100
auth0/node-auth0#1434 · 3 reactions ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
auth0/node-auth0#1387 · 1 comment · 2 reactions ·
Maintainers usually reply within 1 day
-
bug
Difficulty 5/5 Over a week Newbie friendliness 35/100
auth0/node-auth0#1295 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
auth0/node-auth0#1204 · 11 comments · 7 reactions ·
Maintainers usually reply within 1 day
-
bug vNext
Difficulty 3/5 Half a day Newbie friendliness 38/100
auth0/node-auth0#1106 · 3 comments · 1 reaction ·
Maintainers usually reply within 1 day
All issues in auth0/node-auth0
Similar issues
-
`@angular/[email protected]` depends on vulnerable Vite 7.3.7 - GHSA-p4f5-76q4-ffq7 (Critical RCE)Openarea: @angular/build
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
angular/angular-cli#34764 ·
Maintainers usually reply within 1 day
-
status/need-triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
google-gemini/gemini-cli#30384 · 1 comment ·
Maintainers usually reply within 1 day
-
P2
Difficulty 1/5 Under an hour Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
bug ready-for-human
Difficulty 2/5 1-3 hours Newbie friendliness 60/100
LucasSantana-Dev/Lucky#3150 ·
Maintainers usually reply within 1 day
-
enhancement good first issue priority: low size: XS
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day