Class CustomDomainHeader
- Namespace
- Auth0.ManagementApi
- Assembly
- Auth0.ManagementApi.dll
Convenience helper for creating per-request Auth0-Custom-Domain overrides.
Use this when you need to specify a custom domain for a single API call without configuring it globally on the client. The header is forwarded only to whitelisted endpoints — if you have a CustomDomainInterceptor configured on your HttpClient, it is stripped automatically from any non-whitelisted path.
When you need the custom domain header and other RequestOptions settings (extra headers, timeout, retries) in the same call, construct RequestOptions directly instead of using this helper:
await client.Tickets.VerifyEmailAsync(request, new RequestOptions
{
AdditionalHeaders = new[]
{
new KeyValuePair<string, string?>(CustomDomainInterceptor.HeaderName, "login.mycompany.com"),
new KeyValuePair<string, string?>("X-Correlation-Id", "abc-123"),
},
MaxRetries = 1,
});
// Override for a specific request
await client.Tickets.VerifyEmailAsync(request, CustomDomainHeader.For("login.mycompany.com"));
// Override for organization invitations
await client.Organizations.Invitations.CreateAsync(orgId, invitation, CustomDomainHeader.For("login.mycompany.com"));
public static class CustomDomainHeader
- Inheritance
-
CustomDomainHeader
- Inherited Members
Methods
For(string)
Creates a RequestOptions with the Auth0-Custom-Domain header set
to domain.
public static RequestOptions For(string domain)
Parameters
domainstringThe custom domain (e.g.
"login.mycompany.com").
Returns
- RequestOptions
A RequestOptions carrying the custom domain header.
Exceptions
- ArgumentException
Thrown when
domainis null, empty, or whitespace.