SBN

DPoP and Sender-Constrained Tokens, Explained


DPoP and Sender-Constrained Tokens, Explained

A bearer token works for whoever holds it. Steal it from a log file, a browser extension, a misconfigured proxy or a compromised CI runner, and you can call the API as its owner until it expires. Sender-constrained tokens change that. The token is bound to a key the legitimate client holds, and every request must prove possession of that key. DPoP (Demonstrating Proof of Possession, RFC 9449) is the way to do this at the application layer, without client certificates. This post explains how DPoP works, the checks a resource server has to run, which identity providers support it in 2026, and where it does not help. The client and server code was run against the jose library before publishing.

Key Takeaways

  • DPoP binds an access token to a public key. The token carries the key’s thumbprint in cnf.jkt, and each request carries a signed proof JWT in a DPoP header.
  • A resource server must check the proof’s typ, signature, htm, htu, iat, jti and ath, and that the proof key matches the token’s cnf.jkt. It must reject a DPoP-bound token sent as Bearer.
  • DPoP stops replay of stolen tokens from another machine. It does not stop an attacker who can run code in the client, such as through XSS. RFC 9449 calls that “out of scope.”
  • Okta has supported DPoP since 2023. Keycloak made it a supported feature in 26.4 (October 2025). Auth0 lists DPoP as Early Access.

What is a sender-constrained token?

A sender-constrained token can only be used by the client it was issued to, because using it requires a private key that never leaves that client. OAuth has two standard ways to do this:

  • Mutual TLS (RFC 8705). The token is bound to the client’s TLS certificate. Strong, but it needs client certificates and TLS termination that passes the certificate through. Our guide to OAuth mTLS in high-security environments covers it.
  • DPoP (RFC 9449). The token is bound to a key pair the client generates itself. Proof travels in an HTTP header as a signed JWT. It works from browsers, mobile apps and servers, through ordinary load balancers.

The bar for using one has risen. The FAPI 2.0 Security Profile, the OpenID Foundation’s profile for high-value APIs, was approved as a Final Specification in February 2025. It requires sender-constrained access tokens via either mTLS or DPoP (OpenID Foundation). The OpenID Foundation later added DPoP to its FAPI 2.0 conformance tests (OpenID Foundation).

How does DPoP work?

The client creates a key pair, signs a short “proof” JWT for each HTTP request, and the server binds the token to that key’s thumbprint. RFC 9449 was published in September 2023 (RFC 9449). The flow:

  1. Key generation. The client generates an asymmetric key pair, for example ES256, and keeps the private key non-extractable where the platform allows.
  2. Token request. The client sends a DPoP header with a proof signed by that key. The proof header has typ: dpop+jwt, the alg, and the public jwk. The claims are jti, htm (HTTP method), htu (URL without query or fragment) and iat.
  3. Binding. The authorization server returns token_type: DPoP. A JWT access token carries "cnf": { "jkt": "<SHA-256 JWK thumbprint>" }.
  4. API call. The client sends Authorization: DPoP <token> plus a fresh proof. That proof adds ath, the base64url SHA-256 hash of the access token.
  5. Verification. The resource server checks the proof and that its key’s thumbprint equals the token’s cnf.jkt.

A stolen token without the private key fails step 5. A stolen proof fails too. It is bound to one method and URL, has a short iat window, and carries a jti the server remembers.

Nonces close the pre-generation gap

An attacker with temporary access to the client could sign proofs with future iat values and use them later. RFC 9449 lets servers require a nonce. The server answers use_dpop_nonce with a DPoP-Nonce header, and the client retries with that value in the proof’s nonce claim. The RFC notes that “deployments without nonces should avoid long-lived tokens.” If you skip nonces, keep access tokens short.

dpop_jkt binds the authorization code too

Clients can send dpop_jkt, the key thumbprint, on the authorization request. The authorization server then refuses to redeem the code unless the token request’s proof uses the same key. That stops a stolen authorization code from being redeemed by a different client instance.

Client side: creating proofs

The client needs one key pair and a function that signs a proof per request. This works in modern browsers and in Node 20+, using jose:

import { generateKeyPair, exportJWK, SignJWT, base64url } from "jose";

const { privateKey, publicKey } = await generateKeyPair("ES256"); // private key non-extractable by default
const jwk = await exportJWK(publicKey);

async function sha256b64url(value: string) {
  const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(value));
  return base64url.encode(new Uint8Array(digest));
}

export async function dpopProof(htm: string, htu: string, accessToken?: string, nonce?: string) {
  const claims: Record<string, string> = { htm, htu };
  if (accessToken) claims.ath = await sha256b64url(accessToken); // required on resource requests
  if (nonce) claims.nonce = nonce;                                // when the server sent DPoP-Nonce
  return new SignJWT(claims)
    .setProtectedHeader({ alg: "ES256", typ: "dpop+jwt", jwk })
    .setIssuedAt()
    .setJti(crypto.randomUUID())
    .sign(privateKey);
}

// Calling an API:
// fetch(url, { headers: { Authorization: `DPoP ${token}`, DPoP: await dpopProof("GET", urlWithoutQuery, token) } })

In a browser, keep the CryptoKey in IndexedDB rather than exporting it. A non-extractable WebCrypto key can sign but cannot be read out by script, so even an XSS payload cannot copy it to another machine. It can still use it while the page is open, which is the limit discussed below.

Server side: the checks a resource server must run

RFC 9449 Section 4.3 lists the checks. Skipping any one of them reopens the hole DPoP closes. Here they are as code, after you have validated the access token itself (signature, issuer, audience, expiry):

import { jwtVerify, EmbeddedJWK, calculateJwkThumbprint } from "jose";

const seen = new Set<string>();
const stripQuery = (u: string) => { const x = new URL(u); x.search = ""; x.hash = ""; return x.href; };

export async function checkDpop(
  req: { method: string; url: string; dpop?: string },  // url = the external URL the client called
  accessToken: string,
  tokenClaims: { cnf?: { jkt?: string } },
) {
  if (!req.dpop) throw new Error("missing DPoP proof");
  const { payload, protectedHeader } = await jwtVerify(req.dpop, EmbeddedJWK, {
    typ: "dpop+jwt",
    algorithms: ["ES256", "EdDSA", "RS256", "PS256"], // asymmetric only, never none/HS*
    maxTokenAge: "60s",                                // iat window
    requiredClaims: ["jti", "htm", "htu", "iat"],
  });
  if (payload.htm !== req.method) throw new Error("htm mismatch");
  if (stripQuery(String(payload.htu)) !== stripQuery(req.url)) throw new Error("htu mismatch");
  if (payload.ath !== (await sha256b64url(accessToken))) throw new Error("ath mismatch");
  const jkt = await calculateJwkThumbprint(protectedHeader.jwk!, "sha256");
  if (!tokenClaims.cnf?.jkt || jkt !== tokenClaims.cnf.jkt) throw new Error("key not bound to token");
  if (seen.has(payload.jti!)) throw new Error("replayed proof");
  seen.add(payload.jti!); // ponytail: in-memory; use a shared store with TTL across instances
}

sha256b64url is the same helper as on the client. We ran this against four cases: a valid proof passes, a replayed proof fails, a proof for POST fails on a GET, and a token bound to a different key fails.

Three deployment details cause most real-world failures:

  • htu behind a proxy. Compare against the URL the client called (https://api.example.com/v1/invoices), not the internal one your app sees (http://10.0.3.7:8080/v1/invoices). Rebuild it from trusted forwarded headers.
  • Bearer downgrade. RFC 9449 says resource servers MUST reject a DPoP-bound token presented as Bearer. If your middleware accepts Bearer first and never looks at cnf, a thief just changes the scheme. Check for cnf.jkt on every token.
  • Error responses. Answer failures with 401 and WWW-Authenticate: DPoP error="invalid_dpop_proof", or error="use_dpop_nonce" with a DPoP-Nonce header. Clients need these to retry correctly.

Which identity providers support DPoP?

Support is real but uneven. Check your authorization server before you design around it.

Provider DPoP status (checked October 2026) Notes
Okta Supported since June 2023 Announced as “out-of-the-box support for OAuth DPoP token protection for all Okta customers” (Okta)
Keycloak Supported since 26.4 (October 2025); preview from 23.0 Per-client “Require DPoP bound tokens”; can bind only refresh tokens for public clients; supports dpop_jkt (Keycloak)
Auth0 Early Access Auth0 docs show DPoP sender constraining as Early Access, by request (Auth0)

Keycloak’s docs note one limit worth knowing: DPoP is not supported for flows that issue access tokens in the front channel (implicit and hybrid), and with DPoP required such requests are rejected (Keycloak DPoP guide). That is one more reason to use the authorization code flow with PKCE.

What DPoP does not protect against

DPoP makes a stolen token useless elsewhere. It does not make a compromised client safe.

  • Code running in the client. RFC 9449 says that if an attacker can run code in the client’s context, as with XSS, they can use the key to make proofs. That threat is “considered out of scope for DPoP.” Non-extractable keys stop the key from leaving the browser, but not the attacker from using it while the page is open.
  • Request bodies. Only the method and URL are signed. The body and most headers are not, so integrity still relies on TLS. DPoP “does not replace HTTPS.”
  • Authorization. A valid proof says “this is the client the token was issued to.” It says nothing about whether that client may do this action. You still need scopes and permission checks.
  • Lost keys. If a mobile app reinstalls or a browser clears storage, the key is gone and its tokens are useless. That is safe, but the client must handle it by signing in again rather than looping on errors.

Token storage still matters with DPoP. Our comparison of localStorage, sessionStorage and httpOnly cookies covers where to keep tokens. DPoP reduces what a leaked token is worth, so the storage choice is less critical, but it is not a reason to stop caring.

When should you adopt DPoP?

Adopt it where a stolen bearer token would be expensive and mTLS is impractical. Skip it where tokens never leave a trusted server.

Good candidates:

  • Public clients (SPAs, mobile apps, desktop apps, CLIs) calling APIs with long-lived refresh tokens. Binding the refresh token alone, as Keycloak allows, removes most of the value of stealing one.
  • AI agents and MCP clients that hold tokens for many tools on machines you do not control. For the token side of MCP, see MCP authentication and token security.
  • High-value APIs already moving toward FAPI 2.0, such as payments, health data and admin APIs.

Lower value:

A sensible rollout runs in three stages. First accept DPoP alongside bearer for clients that send it, binding when a proof is present. Then require it per client, starting with public clients. Finally require it for refresh tokens everywhere. Keycloak’s per-client “Require DPoP bound tokens” setting maps directly onto that plan.

DPoP protects the tokens your own authorization server issues. Enterprise SSO is the other half: making sure the user behind the token came from their company’s IdP. SSOJet adds per-customer SAML and OIDC SSO and SCIM next to your existing auth, so your token layer, DPoP or not, starts from a verified enterprise identity. The SSOJet docs show the integration.

Sources

Frequently Asked Questions

What is DPoP in OAuth?

DPoP, defined in RFC 9449, is an OAuth 2.0 mechanism that binds access and refresh tokens to a public key held by the client. The client proves it holds the matching private key by sending a signed proof JWT in a DPoP header with each request. A token stolen without the key cannot be used.

What is the difference between DPoP and mTLS?

Both sender-constrain tokens. Mutual TLS (RFC 8705) binds tokens to a client TLS certificate and needs certificate infrastructure end to end. DPoP binds tokens to a key pair the client generates and proves possession in an HTTP header. That makes it practical for browsers, mobile apps and deployments behind ordinary load balancers.

Does DPoP protect against XSS?

Not fully. With a non-extractable WebCrypto key, an XSS payload cannot copy the private key to another machine, so stolen tokens cannot be replayed elsewhere. But code running in the page can still ask the browser to sign proofs while the page is open. RFC 9449 treats that as out of scope, so normal XSS defences still apply.

Do I need DPoP nonces?

Nonces are optional but recommended when tokens live long. They stop proofs pre-signed with future timestamps from being used later. Without nonces, RFC 9449 advises keeping tokens short-lived. Servers request a nonce with the use_dpop_nonce error and a DPoP-Nonce response header.

Can a DPoP-bound token be sent as a Bearer token?

No. RFC 9449 requires resource servers to reject a DPoP-bound token presented with the Bearer scheme. Otherwise an attacker who steals the token could drop the proof and use it as a plain bearer token. Check every incoming token for a cnf.jkt claim and require a valid proof when one is present.