Skip to content

fix(management): forward custom fetch in createManagementAuth client options - #1433

Open
RaphaelFakhri wants to merge 1 commit into
auth0:masterfrom
RaphaelFakhri:fix/management-auth-forward-fetch
Open

RaphaelFakhri wants to merge 1 commit into
auth0:masterfrom
RaphaelFakhri:fix/management-auth-forward-fetch

Conversation

@RaphaelFakhri

Copy link
Copy Markdown

Changes

createManagementAuth now copies the fetch option into the returned clientOptions, and ManagementAuthClientOptions declares the fetch field.

Before this change, the custom fetch was used only for the client credentials token request. Sub-clients created with auth.clientOptions sent Management API requests through the global fetch. ManagementClient already forwards fetch, so this aligns the two, as the createManagementAuth docs describe. The gap is most visible with useMTLS, where the token request uses the mTLS-configured fetch but API calls do not.

  • No endpoints change.
  • ManagementAuthClientOptions gains an optional fetch field. No other public API changes.
  • The new test file is added to .fernignore, alongside the other hand-written unit tests.

References

Testing

New unit tests in src/management/tests/unit/management-auth.test.ts stub the global fetch to reject and check that clientOptions.fetch is set and that a UsersClient built from clientOptions sends requests through the custom fetch, with and without withCustomDomainHeader.

  • Without the fix: 3 of 4 new tests fail; requests reach the global fetch.

  • With the fix: yarn test:unit (636 passed) and yarn test:wire (2621 passed) pass; yarn build, ESLint and Prettier are clean.

  • This change adds unit test coverage

  • This change adds integration test coverage

Checklist

@RaphaelFakhri
RaphaelFakhri requested a review from a team as a code owner October 22, 2026 13:11

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

createManagementAuth drops the custom fetch option from clientOptions

1 participant