import { createManagementAuth } from "auth0/management";
import { ClientsClient } from "auth0/clients";
import { UsersClient } from "auth0/users";
const auth = createManagementAuth({
domain: "your-tenant.auth0.com",
clientId: "your-client-id",
clientSecret: "your-client-secret",
});
const clients = new ClientsClient(auth.clientOptions);
const users = new UsersClient(auth.clientOptions);
Creates a shared authentication context for the Auth0 Management API without pulling in the full ManagementClient. This is useful for size-constrained runtimes (for example Cloudflare Workers) where you import individual sub-clients such as
auth0/clientsandauth0/usersand want to handle auth once.When client credentials are provided, tokens are obtained via the client credentials grant and cached until shortly before they expire. When a static
tokenis provided, it is used as-is.The returned ManagementAuth.clientOptions carry the same telemetry headers, request timeouts, retry counts, logging, and custom domain behaviour that the full
ManagementClientapplies, so individually imported sub-clients behave consistently.