Auth0 Node.js SDK - v6.4.0
    Preparing search index...

    Function createManagementAuth

    • 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/clients and auth0/users and 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 token is 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 ManagementClient applies, so individually imported sub-clients behave consistently.

      Parameters

      Returns ManagementAuth

      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);
      const auth = createManagementAuth({
      domain: "your-tenant.auth0.com",
      token: "your-api-v2-token",
      });
      const auth = createManagementAuth({
      domain: "your-tenant.auth0.com",
      clientId: "your-client-id",
      clientSecret: "your-client-secret",
      withCustomDomainHeader: "auth.example.com",
      });