Beta

Create a tenant

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

Creating a DPoP proof

A DPoP-bound token never travels alone. Each request that uses it carries a short-lived JWT beside it, signed with the client's private key, that describes that one request. This lesson reads the two proofs the printer's phone app makes while it connects Ava's account and opens her first album, and computes the two hashes they depend on.

The proof at the token endpoint

In Binding a token to a key, the phone app sent Ava's code exchange with a DPoP header and received tokens bound to its key. The header held a proof, which is a JWT like any other: a header, a set of claims and a signature, as Inside a JWT described. All domains, codes, and tokens in these examples are fictional. Decoded, that proof reads:

Header:
{
  "typ": "dpop+jwt",
  "alg": "ES256",
  "jwk": {
    "kty": "EC",
    "crv": "P-256",
    "x": "DboN9G_lcWgZ3rxckKu35JwH2OYBLWJgxcT_-KEXK8Y",
    "y": "rj69LkdPmdnAbPoBq6mpcpbJPWLEQ6Qs2SaMMyKWBSk"
  }
}

Claims:
{
  "jti": "demo-proof-1",
  "htm": "POST",
  "htu": "https://auth.photos.example/token",
  "iat": 1790845200
}

The header does more work than usual. typ is dpop+jwt, an explicit type that keeps a proof from being mistaken for any other kind of JWT, and any other JWT from being accepted as a proof. alg names an asymmetric signature algorithm. It can never be none, and never a shared-key algorithm such as HMAC, where whoever checks the signature holds the same key as whoever made it: the point is that only the app can sign. jwk carries the app's public key, the one from Binding a token to a key, and must never include private key members such as d.

The claims describe the request:

  • jti is a unique identifier for this proof. A real one is random, for example at least 96 bits of random data. The readable value here stands in for it.
  • htm is the HTTP method of the request, here POST.
  • htu is the address the request is sent to, without any query string or fragment.
  • iat is when the proof was created, in Unix seconds: 1790845200 is 09:00:00 UTC on 1 October 2026.

The app encodes the header and claims, asks the phone's key storage to sign them with the private key, and puts the result in the DPoP header of the token request. The value begins with the encoded header, eyJ0eXAiOiJkcG9wK2p3dCIsImFsZyI6IkVTMjU2Iiwiandr..., and ends with the signature.

Notice what the proof leaves out. There is no client secret, no authorization code and nothing from the request body. A proof signs only the method, the address, the time and a unique identifier, which keeps it simple to build and check, and TLS protects the rest of the request as it always does.

The proof at the photo API

Twelve seconds later, the app asks for the photos in Ava's album 42. The request carries the access token in the Authorization header, with the DPoP scheme in place of Bearer, and a new proof:

GET /albums/42/photos HTTP/1.1
Host: api.photos.example
Authorization: DPoP demo-app-access-token-1
DPoP: eyJ0eXAiOiJkcG9wK2p3dCIsImFsZyI6IkVTMjU2IiwiandrIjp7Imt0eSI6IkVDIiwiY3J2IjoiUC0yNTYi...

The proof's header is identical, because the key is the same. Its claims are new:

{
  "jti": "demo-proof-2",
  "htm": "GET",
  "htu": "https://api.photos.example/albums/42/photos",
  "iat": 1790845212,
  "ath": "xcbjgyKf_F3-foHYAOd_VdSpNEB0ThBmPo1xXGoYihA"
}

Every claim has changed. The identifier is new, the method and address are those of this request, and the time is 09:00:12. Had the app asked for https://api.photos.example/photos?page=2, the htu would be https://api.photos.example/photos, because the query string is left out.

The new claim, ath, is a hash of the access token sent with the proof, and it is required whenever a proof accompanies an access token. It ties this proof to this token. Without it, a proof made for one request could be paired with a different token the same app holds, for example one issued for a second photo account on the same phone. With it, a proof is useless without its token, and the token is useless without a proof that names it.

Each request carries its own proof. The token endpoint binds the token to the proof's key, and the photo API checks that the next proof comes from the same key and names the same token.

Computing the hashes

Two values in these examples are hashes, and both are easy to get subtly wrong. Both use SHA-256 and the Base64url encoding without padding from Encoding and hashing.

The thumbprint in the token's cnf.jkt is computed from the public key alone. For an elliptic curve key, take only the four required members, crv, kty, x and y, write them as JSON in that alphabetical order with no spaces or line breaks, hash those bytes, and encode the result:

Canonical JSON:
{"crv":"P-256","kty":"EC","x":"DboN9G_lcWgZ3rxckKu35JwH2OYBLWJgxcT_-KEXK8Y","y":"rj69LkdPmdnAbPoBq6mpcpbJPWLEQ6Qs2SaMMyKWBSk"}

jkt = BASE64URL(SHA-256(canonical JSON))
    = BVohHgHi0D9O5iBFRpVSFAukBjzgVbIRUjYuTsfJER8

The fixed form is what makes the thumbprint useful. The authorization server computes it when it binds the token, and the photo API computes it again from the key in each proof, so both must produce exactly the same bytes from the same key.

The ath claim is computed from the access token: the SHA-256 hash of the exact token string, encoded the same way. Here that string is demo-app-access-token-1. For a real JWT access token it is the whole encoded token, exactly as the app received it.

In TypeScript on Node.js, both take a few lines. sha256url hashes a string's UTF-8 bytes and encodes the digest as Base64url; the thumbprint line builds the canonical JSON from the key's four members in order, and the last line hashes the token:

import { createHash } from 'node:crypto';

const sha256url = (text: string) =>
  createHash('sha256').update(text, 'utf8').digest('base64url');

// jwk is the app's public key, as shown above
// JWK thumbprint: required members only, in this order, no whitespace
const jkt = sha256url(JSON.stringify({ crv: jwk.crv, kty: jwk.kty, x: jwk.x, y: jwk.y }));

// Access token hash for the ath claim
const ath = sha256url('demo-app-access-token-1');
// ath === 'xcbjgyKf_F3-foHYAOd_VdSpNEB0ThBmPo1xXGoYihA'

Node's base64url encoding already leaves out the padding. The common mistakes are all small: adding kid or alg to the thumbprint input, letting a JSON library reorder or indent the members, hashing the whole Authorization header value instead of the token, or encoding with ordinary Base64, whose +, / and = characters make a different string. Each one produces a value that looks plausible and never matches.

Check your understanding

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

The phone app calls GET https://api.photos.example/photos?page=2 with Ava's bound token. What goes in the proof's htu claim? 1 of 3

Choose one answer.

A developer computes ath by hashing the whole header value "DPoP demo-app-access-token-1". What happens? 2 of 3

Choose one answer.

The authorization server hashed the app's key with kid and alg included, while the API hashes only crv, kty, x and y. What follows? 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