createManagementAuth drops the custom fetch option from clientOptions

未关闭 适合新手
#1,432 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@RaphaelFakhri 已经在做这个了。

开始于 2026年10月22日。

  • #1433 来自 @RaphaelFakhri —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
77/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃

调研方向

先阅读 createManagementAuth 和 ManagementClientOptions 类型,然后比较 ManagementClient 转发 fetch 的方式与构建 clientOptions 的方式。添加一个有针对性的测试,传入自定义 fetch,并检查它是否被保留且由子客户端使用。issue 没有给出测试文件名,因此请查找现有的 management auth 测试。子客户端请求使用所提供的函数,即为完成。

由索引模型根据 Issue 内容生成。

描述

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
主要语言
TypeScript
星标
683
派生
319
平均合并
1 天 30 分钟
30 天内合并 PR
13

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

auth0/node-auth0 的其他 Issue

查看 auth0/node-auth0 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。