What DPoP is
DPoP, short for Demonstrating Proof of Possession, binds OAuth tokens to a key that only the client holds. It is defined in RFC 9449.
A normal bearer token works for anyone who has it. If it leaks through a log, a proxy or a compromised browser extension, the thief can use it until it expires. With DPoP, the server binds the token to the client’s public key. Every request must then carry a fresh proof signed with the matching private key. A stolen token without the key is useless.
RFC 9700, the OAuth security best current practice, recommends sender-constrained access tokens, and names DPoP and mutual TLS as ways to get them. DPoP works at the application layer, so it suits browsers and mobile apps where client certificates are hard to use.
What a DPoP proof contains
A proof is a short-lived JWT, sent in a DPoP HTTP header. Its header names the key, and its payload names the request it is for.
| Part | Field | Meaning |
|---|---|---|
| Header | typ | Always dpop+jwt. |
| Header | alg | An asymmetric signing algorithm, such as ES256. Never none or an HMAC. |
| Header | jwk | The public key, without any private part. |
| Payload | jti | A unique id for this proof, so the server can spot replays. |
| Payload | htm | The HTTP method of the request, such as POST. |
| Payload | htu | The request URL, without query and fragment. |
| Payload | iat | When the proof was made, in seconds since 1970. |
| Payload | ath | The Base64url SHA-256 hash of the access token, when one is sent. |
| Payload | nonce | A value the server asked for, when it uses nonces. |
How DPoP works step by step
- The client makes a key pair and keeps the private key to itself.
- At the token endpoint, it sends a proof for
POSTand the token endpoint URL in aDPoPheader. - The server checks the proof and issues an access token bound to the key. The token response says
token_typeisDPoP, and the token records the key’s thumbprint incnf.jkt. - For each API call, the client sends
Authorization: DPoP <token>and a new proof for that method and URL, withathset to the hash of the token. - The API checks the proof’s signature,
htm,htu,iat,athand that the proof’s key matchescnf.jktin the token.
POST /realms/acme/protocol/openid-connect/token HTTP/1.1
Host: auth.example.com
Content-Type: application/x-www-form-urlencoded
DPoP: eyJ0eXAiOiJkcG9wK2p3dCIs...SAMPLE
grant_type=authorization_code&code=SAMPLE_CODE&client_id=web-app&...{
"access_token": "SAMPLE_ACCESS_TOKEN",
"token_type": "DPoP",
"expires_in": 300
}Server nonces
A server may require a nonce from itself in each proof, to limit how long a proof made in advance stays useful. It answers the first request with the error use_dpop_nonce and a DPoP-Nonce header. The client puts that value in the proof’s nonce claim and sends the request again.
Binding the authorization code
In the code flow, the client can also send dpop_jkt, the thumbprint of its key, in the authorization request. The server then binds the code to that key, so only the same key can redeem it (RFC 9449 section 10).
What this tool does
The tool makes a P-256 key pair in your browser with Web Crypto and signs DPoP proofs with it, using ES256.
- It sets
htmfrom the method you pick andhtufrom the URL you enter, with query and fragment removed. - It adds
athwhen you paste an access token, andnoncewhen you enter one. - It gives each proof a new random
jtiand the currentiat. - It shows the proof, the request headers, the decoded header and payload, the public JWK and its RFC 7638 thumbprint, which is what the server records as
cnf.jkt.
The private key is created as non-extractable. It cannot be exported, and it is gone when you close the tab. That makes the tool right for testing a server or learning the format, and wrong for anything that must keep working later. The tool also does not send requests or verify proofs from other clients.
How to use the tool
- Open the page. A key is made at once, and a proof for the sample token endpoint appears.
- Pick the HTTP method of the request you want to test.
- Enter the request URL. For a token request, use your token endpoint.
- For an API call, paste the access token so the proof carries
ath. - If the server answered
use_dpop_nonce, copy itsDPoP-Nonceheader value into the nonce field. - Copy the request headers into your test request. Press New proof before each new request.
Where DPoP pays off
Single-page apps
Tokens in a browser are exposed to cross-site scripting and extensions. A non-extractable Web Crypto key cannot be read by script, so even code that steals the token cannot copy the key. It can still make requests while it runs in the page, so DPoP limits the damage rather than removing it.
Mobile apps
A mobile app can keep the key in the platform’s secure hardware. Refresh tokens bound to that key cannot be used from another device.
Public clients and refresh tokens
Public clients have no secret, so a stolen refresh token is normally enough to get new tokens. With DPoP, refresh tokens issued to public clients are bound to the key, which RFC 9700 accepts as an alternative to refresh token rotation.
APIs that handle sensitive data
An API can refuse bearer tokens and accept only DPoP-bound ones, so a token copied out of a log cannot be replayed against it.
DPoP and Keycloak
Keycloak can issue DPoP-bound tokens. Support and the way to require it per client have changed across releases, so check the documentation for your version before relying on it. A server that supports DPoP lists dpop_signing_alg_values_supported in its discovery document, which you can read with the OIDC discovery viewer.
The proof flow is the same as with any server: send a proof to /realms/<realm>/protocol/openid-connect/token, then use Authorization: DPoP with a new proof at the API or at the UserInfo endpoint.
Common errors and how to fix them
invalid_dpop_proof
htmorhtudoes not match the request. Check the method, the scheme, the host and the path. Leave the query out ofhtu.iatis too old or in the future. Make a new proof, and check the clock of the machine making it.- The proof was reused. Each proof needs its own
jti; make a new one per request. athis missing or wrong on an API call. Hash the exact access token you send.- The proof was signed with a different key than the one the token is bound to.
use_dpop_nonce
Not a failure. Copy the DPoP-Nonce response header into the proof’s nonce and repeat the request. Nonces can change, so always use the latest one.
invalid_token at the API
The API may expect the DPoP scheme but received Bearer, or the other way round. A DPoP-bound token must be sent with Authorization: DPoP.
Security notes and best practices
- Make the private key non-extractable where the platform allows it, and never send it anywhere.
- Make a new proof for every request. Proofs are cheap.
- Keep the key for the lifetime of the tokens bound to it. If the key is lost, the client must sign in again.
- Use ES256 unless the server asks for something else; it is widely supported and its keys are small.
- DPoP does not replace short token lifetimes, PKCE or careful redirect URIs. It adds a layer on top of them.
If you would rather not run and upgrade Keycloak yourself, read our docs on how we run it on a dedicated cluster per customer.