Skip to content

feat:Add Auth0-Custom-Domain header support for Multiple Custom Domains (MCD)#799

Open
kishore7snehil wants to merge 1 commit intomasterfrom
feat/mcd-support
Open

feat:Add Auth0-Custom-Domain header support for Multiple Custom Domains (MCD)#799
kishore7snehil wants to merge 1 commit intomasterfrom
feat/mcd-support

Conversation

@kishore7snehil
Copy link
Contributor

Added support for the Auth0-Custom-Domain header to enable Multiple Custom Domains (MCD).

Changes

  • Added custom_domain parameter to ManagementClient and AsyncManagementClient for setting the Auth0-Custom-Domain header globally
  • Added CustomDomainHeader helper for per-request header override via request_options
  • Implemented whitelist enforcement via httpx event hooks , header is only sent on 8 whitelisted endpoints, stripped on all others
Path Description
/api/v2/jobs/verification-email Verification email jobs
/api/v2/tickets/email-verification Email verification tickets
/api/v2/tickets/password-change Password change tickets
/api/v2/organizations/{id}/invitations Organization invitations
/api/v2/users Users (list/create)
/api/v2/users/{id} Users (get/update/delete)
/api/v2/guardian/enrollments/ticket Guardian enrollment tickets
/api/v2/self-service-profiles/{id}/sso-ticket SSO tickets

Enforcement is implemented via httpx request event hooks that strip the header on non-whitelisted paths before the request is sent.

  • Per-request CustomDomainHeader takes precedence over the global custom_domain when both are provided
  • Added 22 unit tests covering initialization, header merging, whitelist enforcement, and async support
  • Updated README.md with Custom Domains documentation

Usage

from auth0.management import ManagementClient, CustomDomainHeader

# Global — header sent on all whitelisted endpoints
client = ManagementClient(
    domain="your-tenant.auth0.com",
    token="YOUR_TOKEN",
    custom_domain="login.mycompany.com",
)

# Per-request override
client.users.create(
    connection="Username-Password-Authentication",
    email="user@example.com",
    password="SecurePass123!",
    request_options=CustomDomainHeader("other.mycompany.com"),
)

References

Checklist

  • All new/changed/fixed functionality is covered by tests
  • I have added documentation for all new/changed functionality
  • No Fern-generated files modified (all changes in .fernignore-listed files)

@kishore7snehil kishore7snehil requested a review from a team as a code owner March 23, 2026 08:16
@duedares-rvj
Copy link
Member

LGTM

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.

MCD EA support

2 participants