Cerbos JavaScript SDK
    Preparing search index...

    Loader to fetch policy bundles from Cerbos Hub.

    Index

    Constructors

    Properties

    Methods

    Constructors

    • Load policy bundles from Cerbos Hub.

      Parameters

      Returns PolicyLoader

      Unauthenticated access:

      const loader = new PolicyLoader({ ruleId: "B5LU9EVYN1MD" });
      

      Authenticate with a client credential:

      import { credentialsFromEnv } from "@cerbos/hub";

      const loader = new PolicyLoader({
      ruleId: "B5LU9EVYN1MD",
      credentials: credentialsFromEnv(),
      });

      Handle policy update errors:

      const loader = new PolicyLoader({
      ruleId: "B5LU9EVYN1MD",
      onUpdate: (error) => {
      if (error) {
      console.error("Cerbos policy update failed:", error);
      } else {
      console.info("Cerbos policies updated successfully");
      }
      },
      });

    Properties

    ruleId: string

    ID of the policy bundling rule.

    scopes: string[]

    Scopes to include in the policy bundle.

    Methods