Skip to main content

Overview

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

DPoPError

Thrown when a DPoP operation fails. All DPoP errors extend from SdkError.

Properties

DPoPErrorCode
required
The specific DPoP error code indicating the type of failure. See DPoP Error Codes below.
string
required
A descriptive error message explaining what went wrong.
Error | undefined
The underlying error that caused this DPoP error, if available.

DPoP Error Codes

The DPoPErrorCode enum categorizes different types of DPoP failures:

DPOP_JKT_CALCULATION_FAILED

Failed to calculate the dpop_jkt (JWK thumbprint) parameter. When Thrown:
  • The SDK cannot generate the required thumbprint from the provided public key for the authorization request
  • Invalid or corrupted key pair
  • Incompatible key algorithm
Example:

DPOP_KEY_EXPORT_FAILED

Failed to export DPoP public key to JWK format. When Thrown:
  • The SDK cannot convert the CryptoKey to the JSON Web Key format required for DPoP proofs
  • Key is not extractable
  • Unsupported key type or algorithm
Example:

DPOP_CONFIGURATION_ERROR

DPoP configuration is invalid or incomplete. When Thrown:
  • The provided DPoP configuration contains invalid values
  • Missing required DPoP configuration components
  • Incompatible DPoP configuration options
Example:

Complete Error Handling Example

Generating Valid DPoP Key Pairs

To avoid DPoP errors, ensure your key pairs are generated correctly:

Common DPoP Issues

Non-extractable keys

Ensure keys are created with extractable: true when using crypto.subtle.generateKey() or crypto.subtle.importKey().

Unsupported algorithms

DPoP typically supports ES256 (ECDSA with P-256 curve). Verify your authorization server’s supported algorithms.

Key persistence

DPoP key pairs should be persisted across sessions to maintain token binding. Consider storing keys securely in your session or database.

Browser compatibility

DPoP uses the Web Crypto API. Ensure your environment supports the required cryptographic operations.

Environment Variables

DPoP can be configured via environment variables:

Catching DPoP Errors by Code

The recommended approach is to check the error code: