@auth0/nextjs-auth0 - v4.11.0
    Preparing search index...

    Class DPoPError

    Represents an error that occurred during DPoP (Demonstrating Proof-of-Possession) operations.

    DPoP is an OAuth 2.0 extension that provides application-level proof-of-possession security by binding access tokens to cryptographic key pairs. This error is thrown when DPoP-related operations fail, such as key pair operations, proof generation, or configuration issues.

    Common scenarios that trigger DPoPError:

    • Invalid or incompatible key pairs (wrong algorithm, corrupted keys)
    • JWK thumbprint calculation failures
    • Public key export failures to JWK format
    • Invalid DPoP configuration parameters
    try {
    const auth0 = new Auth0Client({
    useDPoP: true,
    dpopKeyPair: invalidKeyPair
    });
    } catch (error) {
    if (error instanceof DPoPError) {
    console.error(`DPoP Error [${error.code}]:`, error.message);

    switch (error.code) {
    case DPoPErrorCode.DPOP_KEY_EXPORT_FAILED:
    console.error("Key export failed. Check key format and algorithm.");
    break;
    case DPoPErrorCode.DPOP_JKT_CALCULATION_FAILED:
    console.error("JWK thumbprint calculation failed. Verify key validity.");
    break;
    case DPoPErrorCode.DPOP_CONFIGURATION_ERROR:
    console.error("Invalid DPoP configuration. Check options and environment variables.");
    break;
    }

    if (error.cause) {
    console.error("Underlying cause:", error.cause);
    }
    }
    }
    throw new DPoPError(
    DPoPErrorCode.DPOP_JKT_CALCULATION_FAILED,
    "Failed to calculate dpop_jkt parameter from public key",
    originalError
    );

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Constructors

    • Constructs a new DPoPError instance.

      Parameters

      • code: DPoPErrorCode

        The DPoP error code indicating the specific type of failure

      • message: string

        A descriptive error message explaining what went wrong

      • Optionalcause: Error

        The underlying error that caused this DPoP error (optional)

      Returns DPoPError

      const dpopError = new DPoPError(
      DPoPErrorCode.DPOP_KEY_EXPORT_FAILED,
      "Unable to export public key to JWK format",
      keyExportError
      );

    Properties

    cause?: Error

    The underlying error that caused this DPoP error (optional)

    The specific DPoP error code indicating the type of failure