Skip to content

feat: Add support for default custom domain and deprecation warning for enable_custom_domain_in_emails #1330

Merged
kushalshit27 merged 11 commits intomasterfrom
DXCDT-1326
Apr 10, 2026
Merged

feat: Add support for default custom domain and deprecation warning for enable_custom_domain_in_emails #1330
kushalshit27 merged 11 commits intomasterfrom
DXCDT-1326

Conversation

@ankita10119
Copy link
Copy Markdown
Contributor

@ankita10119 ankita10119 commented Mar 23, 2026

Context

The Auth0 Management API is introducing a new default custom domain concept as part of the Multiple Custom Domains (MCD) GA release. Tenants can now designate one of their verified custom domains as the default, this domain is used in email/phone notification links (e.g. password reset, email verification) when no explicit auth0-custom-domain header is sent by the API client.

Two new Management API endpoints are being introduced:

  • GET /api/v2/custom-domains/default , returns the current default domain
  • PATCH /api/v2/custom-domains/default , sets the default domain

This PR implements Deploy CLI support for both changes ahead of the API going live.

🔧 Changes

src/tools/auth0/handlers/customDomains.ts

  • Added is_default as an optional boolean field to the custom domain JSON schema so it can be declared in YAML configs
  • is_default remains in stripCreateFields and stripUpdateFields, the regular PATCH /api/v2/custom-domains/{id} endpoint rejects it as read-only per the RFC, it can only be set via the dedicated default endpoint
  • Added a setDefaultDomain() private method that calls PATCH /api/v2/custom-domains/default directly since this endpoint is not yet available in the auth0 Node.js SDK. The method reuses the SDK client's internal auth provider (_options.authProvider) via type assertion to avoid duplicating token management logic
  • processChanges now calls setDefaultDomain() after the normal create/update/delete cycle completes, if any domain in the config has is_default: true

src/tools/auth0/handlers/tenant.ts

  • Added a deprecation warning when enable_custom_domain_in_emails is found in tenant flags, guiding users to migrate to the is_default field on customDomains
  • The flag remains in allowedTenantFlags since it hasn't been removed from the API yet

examples/yaml/tenant.yaml

  • Added is_default: true to the custom domain example to document the new field

test/tools/auth0/handlers/customDomains.test.ts

  • Updated the existing strip-fields test to mock _options on the custom domains client and stub globalThis.fetch, since is_default: true in the test data now triggers the setDefaultDomain call

📚 References

🔬 Testing

Unit tests

  • All 15 existing custom domain handler tests pass
  • Verified is_default is correctly stripped from both create and update API payloads
  • Verified setDefaultDomain is triggered when is_default: true is present in the config

Manual testing against a real tenant

  • Confirmed the Auth0 Management API already returns is_default on GET /api/v2/custom-domains responses - the field is live
  • Ran the local build with a YAML declaring a custom domain as is_default: true
  • All custom domains were updated successfully via the regular create/update path
  • The setDefault SDK call successfully reached PATCH /api/v2/custom-domains/default with the correct payload
  • Confirmed via GET /api/v2/custom-domains after the import that the target domain
    was set as the default - full end-to-end flow verified

📝 Checklist

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

@ankita10119 ankita10119 requested a review from a team as a code owner March 23, 2026 09:51
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 23, 2026

Codecov Report

❌ Patch coverage is 94.44444% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 80.10%. Comparing base (8e4ef6d) to head (eeda9d8).

Files with missing lines Patch % Lines
src/tools/auth0/handlers/customDomains.ts 92.85% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1330      +/-   ##
==========================================
+ Coverage   80.06%   80.10%   +0.03%     
==========================================
  Files         152      152              
  Lines        6196     6212      +16     
  Branches     1286     1290       +4     
==========================================
+ Hits         4961     4976      +15     
- Misses        701      702       +1     
  Partials      534      534              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kushalshit27 kushalshit27 marked this pull request as draft March 24, 2026 05:35
Comment thread src/tools/auth0/handlers/customDomains.ts Outdated
Comment thread src/tools/auth0/handlers/customDomains.ts Outdated
Comment thread src/tools/auth0/handlers/customDomains.ts Outdated
Comment thread src/tools/auth0/handlers/tenant.ts
Comment thread test/tools/auth0/handlers/customDomains.test.ts Outdated
Comment thread src/tools/auth0/handlers/customDomains.ts Outdated
@ankita10119 ankita10119 marked this pull request as ready for review April 9, 2026 17:01
@kushalshit27 kushalshit27 merged commit be183e1 into master Apr 10, 2026
8 checks passed
@kushalshit27 kushalshit27 deleted the DXCDT-1326 branch April 10, 2026 04:26
@kushalshit27 kushalshit27 mentioned this pull request Apr 10, 2026
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.

3 participants