Beta

Create a tenant

A new tenant starts with its own users, OAuth settings, audit history and logs. You are its first Tenant Admin.

Validating proofs at the server

A proof protects nothing until someone checks it. The photo service's authorization server decides whether to bind new tokens to the key in a proof, and the photo API decides whether the proof in front of it comes from the key its token was bound to. Both start from the same checks on the proof itself, then add their own.

Checking a proof

Creating a DPoP proof read the proofs the printer's phone app sends while it works with Ava's photos. For every request that carries a DPoP header, the server that receives it confirms that:

  1. There is exactly one DPoP header, and it holds a single, well-formed JWT.
  2. The required claims are present: jti, htm, htu and iat.
  3. The typ header is dpop+jwt.
  4. The alg header names an asymmetric signature algorithm this server accepts. none and shared-key algorithms are always refused.
  5. The signature verifies with the public key in the jwk header, and that key contains no private key members.
  6. htm matches the method of this request, and htu matches the address it was sent to, ignoring any query string and fragment.
  7. The proof was created recently enough, judged from iat. A server may also require a value of its own in the proof, which Nonces and replay handling describes.

The order does not matter, and any failure rejects the request.

Step five may look alarming. Token formats and validation warned never to verify an access token with a key embedded in the token itself, because an attacker can embed their own. A DPoP proof is verified with exactly that kind of key, and it is safe here because the signature is not what makes the proof trustworthy. It only shows that the sender holds the private key matching the public key in the header. Trust comes from a later comparison: whether that public key is the one the authorization server bound to the token. Someone who copied Ava's token and signed a proof with their own key passes step five perfectly, then fails that comparison.

Proof from Ava's phone key

  • typ is dpop+jwt
  • Signature verifies with the jwk header
  • htm and htu match this request
  • iat is recent
  • ath is the hash of this token
  • Key thumbprint equals cnf.jkt

Accepted

Proof from a key of their own

  • typ is dpop+jwt
  • Signature verifies with the jwk header
  • htm and htu match this request
  • iat is recent
  • ath is the hash of this token
  • Key thumbprint equals cnf.jkt

401 invalid_dpop_proof

It only shows that the sender holds the private key matching the public key in the header.

A proof from another key passes every check on the proof itself, including its signature. Only the comparison with cnf.jkt tells it apart from the phone app's proof.

Step six has a practical trap. The htu claim holds the address the client used, such as https://api.photos.example/albums/42/photos. A server behind a load balancer, a front server that spreads requests across several machines, often sees an internal host name or a different scheme. It has to compare against the public address, after normalizing details such as letter case in the host name and default ports. Comparing against the internal address fails every honest proof.

At the token endpoint

When a proof passes, the authorization server computes the thumbprint of its public key and binds the tokens it issues to that thumbprint, as Binding a token to a key showed. When it fails, the token endpoint answers with an ordinary OAuth error response. All domains, codes, and tokens in these examples are fictional:

HTTP/1.1 400 Bad Request
Content-Type: application/json
Cache-Control: no-store

{
  "error": "invalid_dpop_proof"
}

Refreshing works the same way. The phone app is a public client, so its refresh token was bound to its key when it was issued, and every refresh must carry a proof from that same key. The proof is shortened here for display:

POST /token HTTP/1.1
Host: auth.photos.example
Content-Type: application/x-www-form-urlencoded
DPoP: eyJ0eXAiOiJkcG9wK2p3dCIsImFsZyI6IkVTMjU2IiwiandrIjp7Imt0eSI6IkVDIiwiY3J2IjoiUC0yNTYi...

grant_type=refresh_token
&refresh_token=demo-app-refresh-token-1
&client_id=photo-printer-app

Its htm is POST and its htu is the token endpoint, exactly as in the code exchange. The server checks the proof, then checks that its key's thumbprint equals the one recorded for this refresh token. A refresh token copied out of the phone's storage cannot be redeemed without the key, however long it remains valid.

Confidential clients are treated differently. The printer's web server authenticates every time it uses a refresh token, so its refresh tokens are already tied to it, and the authorization server does not also bind them to a DPoP key. That lets the server change its DPoP key without losing the grants it holds; each new access token is bound to whichever key the refresh proof carried.

Two further features tighten the binding. Client metadata, the settings recorded when a client is registered, as Redirect URIs and client metadata described, can include dpop_bound_access_tokens. A client registered with that value set to true has declared that it always uses DPoP, so the server must reject any token request from it that has no proof. And the optional dpop_jkt authorization request parameter carries the key's thumbprint at the start of the flow, so the authorization code itself is bound to the key. A code stolen on its way back to the printer is then refused unless the token request carries a proof from that key.

With a pushed authorization request

A client that uses pushed authorization requests has an earlier chance to show its key. The phone app's push is an ordinary POST to the authorization server, so it can carry a DPoP header of its own, with a proof whose htm is POST and whose htu is the PAR endpoint. The proof is shortened here for display:

POST /par HTTP/1.1
Host: auth.photos.example
Content-Type: application/x-www-form-urlencoded
DPoP: eyJ0eXAiOiJkcG9wK2p3dCIsImFsZyI6IkVTMjU2IiwiandrIjp7Imt0eSI6IkVDIiwiY3J2IjoiUC0yNTYi...

response_type=code
&client_id=photo-printer-app
&redirect_uri=https%3A%2F%2Fapp.printer.example%2Foauth%2Fcallback
&scope=photos.read
&state=demo-app-attempt-1
&code_challenge=AjY8lXvV3Ro_uMHLqaXqgPvodB56u3GIaIuOg5lr5mU
&code_challenge_method=S256

The server checks the proof like any other and records its key's thumbprint with the pushed request. The authorization code it later issues for that request is bound to the key, exactly as if the app had sent dpop_jkt, and the token request that redeems the code must carry a proof from the same key. The app may send both. If it does, the server refuses the push unless the dpop_jkt value equals the thumbprint of the key in the header.

The header shows something the parameter cannot. dpop_jkt only names a thumbprint, which anyone could copy, while a proof is signed, so the server knows before any code exists that the app really holds the private key. The proof still does not authenticate the app. The phone app remains a public client, and a confidential client authenticates at the PAR endpoint exactly as it would without DPoP.

The app learns which algorithms the server accepts for proofs from dpop_signing_alg_values_supported in the server's metadata document, the same kind of published document Reading provider metadata read for an OpenID provider. Discovering server capabilities covers the OAuth version in detail.

At the photo API

When the photo API sees Authorization: DPoP demo-app-access-token-1, the scheme tells it to expect a bound token and a proof. It validates the token exactly as it would any access token, checks the proof as listed above, then makes the two comparisons only an API can make:

  • ath in the proof equals the Base64url SHA-256 hash of the token in the Authorization header.
  • The thumbprint of the proof's public key equals the token's cnf.jkt.

For a JWT access token, cnf.jkt is in the token's claims. For an opaque token, it comes from the introspection response. The authorization server does not check the proof during introspection: the API sends only the token, receives the thumbprint, and makes the comparison itself.

A failure gets a challenge in the WWW-Authenticate header, using the error codes Using access tokens described, with the DPoP scheme and an algs parameter listing the algorithms the API accepts for proofs:

HTTP/1.1 401 Unauthorized
WWW-Authenticate: DPoP error="invalid_dpop_proof", algs="ES256"

The same answer covers a proof from a key other than the token's and a proof that is malformed or wrongly signed. Some APIs report the key mismatch as error="invalid_token" instead, treating it as a fault in the token's binding; the DPoP specification allows either.

One more case needs a deliberate rule. Suppose someone copies Ava's bound token and sends it as Authorization: Bearer demo-app-access-token-1, with no proof at all. An API that supports both schemes must notice that the token is bound, from its cnf claim or the introspection result, and reject it. Accepting it would turn the binding into an option the copier can decline.

That rule exists only where an API knows about DPoP. An older API that understands only bearer tokens ignores the unfamiliar cnf claim and accepts the copied token. A binding protects a token exactly where it is checked, so every API that receives DPoP-bound tokens needs these comparisons before the protection is real.

Check your understanding

Try these questions before moving on. If an answer isn't right, use the feedback and try again.

Someone sends a copy of Ava's DPoP-bound token with a proof signed by their own key, and the signature verifies. Which check refuses the request? 1 of 3

Choose one answer.

The photo API supports both Bearer and DPoP. A request arrives with "Authorization: Bearer" and a token whose claims include cnf.jkt, but no proof. What should the API do? 2 of 3

Choose one answer.

The printer's web server, a confidential client, replaces its DPoP key and refreshes with a proof from the new key. What happens? 3 of 3

Choose one answer.

Try it in the Lab

We value your privacy

We use cookies and similar technologies to enhance your browsing experience, and analytics to understand our traffic. By clicking "Allow all", you consent to optional analytics. Cookie Policy

Learn identity