Skip to content

feat(auth0-fastify-api): Add DPoP support on auth0-fastify-api#60

Merged
nandan-bhat merged 5 commits into
mainfrom
feature/DPoP/SDK-8697
May 18, 2026
Merged

feat(auth0-fastify-api): Add DPoP support on auth0-fastify-api#60
nandan-bhat merged 5 commits into
mainfrom
feature/DPoP/SDK-8697

Conversation

@nandan-bhat
Copy link
Copy Markdown
Contributor

@nandan-bhat nandan-bhat commented May 7, 2026

Summary

Adds DPoP (Demonstration of Proof-of-Possession, RFC 9449) support to @auth0/auth0-fastify-api. DPoP binds access tokens to a client's key pair, preventing stolen tokens from being replayed by attackers.

The SDK now automatically extracts the DPoP proof header, detects the authorization scheme (Bearer vs DPoP), and delegates full cryptographic validation to the underlying @auth0/auth0-api-js SDK.

Changes

  • Plugin configuration: Added dpop option with mode (allowed | required | disabled), iatOffset, and iatLeeway settings.
  • Token extraction: Recognizes both Authorization: Bearer <token> and Authorization: DPoP <token> schemes.
  • DPoP proof forwarding: Extracts the DPoP request header and passes it along with httpMethod, httpUrl, and scheme to ApiClient.verifyAccessToken().
  • Error handling: Properly surfaces InvalidDpopProofError (400), InvalidRequestError (400), and VerifyAccessTokenError (401) with RFC-compliant WWW-Authenticate challenge headers.
  • Exports: Re-exports DPoPOptions, InvalidDpopProofError, InvalidRequestError, and VerifyAccessTokenError for consumer error handling.
  • Documentation: Added DPoP sections to both README.md and EXAMPLES.md covering configuration, modes, error handling, timing, and MCD integration.

Configuration

fastify.register(fastifyAuth0Api, {
  domain: '<AUTH0_DOMAIN>',
  audience: '<AUTH0_AUDIENCE>',
  dpop: {
    mode: 'required',        // 'allowed' (default) | 'required' | 'disabled'
    iatOffset: 300,          // optional, default: 300
    iatLeeway: 30,           // optional, default: 30
  },
});

@nandan-bhat nandan-bhat force-pushed the feature/DPoP/SDK-8697 branch from 41f48a7 to eec551a Compare May 18, 2026 13:18
@nandan-bhat nandan-bhat force-pushed the feature/DPoP/SDK-8697 branch from eec551a to fd48e16 Compare May 18, 2026 13:55
Copy link
Copy Markdown

@kishore7snehil kishore7snehil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@nandan-bhat nandan-bhat merged commit 94a00d0 into main May 18, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants