Certificate-bound access tokens
The certificate a client presents in its mutual TLSTransport Layer Security, the protection behind HTTPS. It encrypts traffic between two connected systems, detects changes on the way, and uses certificates so the client can confirm which server it reached. handshake can also bind the tokens it receives, so an APIAn application programming interface: a defined way for software to interact with a service. A web API offers endpoints where other programs send HTTP requests. accepts the tokenA piece of data issued by a trusted service that a client presents as a credential, for example to call an API or to report a sign-in. Some tokens carry readable claims; others are random strings that only the issuer can interpret. only over a connection made with that certificate. This lesson binds the printer's order service's token at the print lab, checks it at the print lab's API, extends it to a public clientAn OAuth client, such as code running in a browser or an app on a phone, that cannot keep a credential secret because the people using it can inspect it. It relies on protections such as PKCE instead of a client secret., follows it through a proxy that ends TLS, and compares it with DPoPAn OAuth extension, RFC 9449, that binds tokens to a key pair the client holds. The client signs a fresh proof for each request, so a stolen token is useless without the private key..
Binding the token to the certificate
The order service now authenticates to the print lab with its certificate, as Authenticating a client with a certificate showed. The token it receives, though, is still an ordinary bearer tokenA token that works for whoever presents it: the API checks that the token is genuine and current, not who is holding it. That is why bearer tokens must be kept from being copied.. If the print lab's API writes it to a log, or a misconfigured proxy records it, anyone holding a copy can submit print jobs as the printer until it expires fifteen minutes later.
The certificate can close that gap too. All domains, identifiers, and tokens in these examples are fictional. The token request arrives over a mutual TLS connection, so the authorization serverIn OAuth, the service that handles a person's sign-in and approval and decides which tokens to issue to a client. It may belong to the same company as the API, but its job is separate. takes the client certificate from its TLS layer, calculates a SHA-256 hashTurning data into a short, fixed-size value called a hash, in a way that cannot be reversed and where changing one character changes the result completely. Services store password hashes instead of passwords, and signatures are made over a hash. of the certificate's binary DER encoding, and records that certificate thumbprint with the token. The response looks the same as before:
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: no-store
{
"access_token": "demo-lab-access-token-3",
"token_type": "Bearer",
"expires_in": 900,
"scope": "print-jobs.write"
}Unlike DPoP, mutual TLS adds no new token type. The order service sends the token in an ordinary Bearer header; what changes is the connection it must travel on. Decoded, the token's claims carry the binding:
{
"iss": "https://auth.printlab.example",
"sub": "printer-orders",
"aud": "https://api.printlab.example",
"client_id": "printer-orders",
"scope": "print-jobs.write",
"iat": 1790881200,
"exp": 1790882100,
"jti": "demo-lab-token-id-3",
"cnf": {
"x5t#S256": "upcMvPttuVZhYLYqzpqiqONaXZb2mD-2bd4QPsKEw2M"
}
}As with DPoP, the cnf claim says what a presenter of this token must prove. Its x5t#S256 member holds the certificate thumbprint, encoded as Base64urlA way of encoding data as ordinary text characters so it can travel safely in headers, URLs, and JSON. Anyone can decode it, so it hides nothing; Base64url is a variant safe for URLs, used in JWTs. without padding. The token was issued at 19:00 UTC on 1 October 2026 and expires fifteen minutes later. If the token were opaque, the API would receive the same cnf member in an introspectionA way for an API to ask the authorization server what a token means: whether it is still active and what access it carries. APIs need it when a token is a random string that only the authorization server can interpret. response.
The print lab advertises the capability with tls_client_certificate_bound_access_tokens set to true in its metadata, and a client can declare the same setting in its registration to say it intends to use bound tokens. The binding does not depend on how the client authenticated: a client using private_key_jwt over a mutual TLS connection could receive a bound token too.
Checking the certificate at the API
To submit a job, the order service opens a mutual TLS connection to the print lab's API with the same certificate and sends:
POST /print-jobs HTTP/1.1
Host: api.printlab.example
Authorization: Bearer demo-lab-access-token-3
Content-Type: application/json
{ "order": "book-5562", "product": "hardcover-a4" }The API validates the token exactly as it would any other. Then it asks its TLS layer for the certificate the client presented on this connection, calculates that certificate's SHA-256 thumbprint, and compares it with the token's cnf value. If they differ, or no certificate was presented, the request is refused:
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer error="invalid_token"Someone who copied the token from a log can send it, but only over a connection of their own. They cannot complete a handshake with the order service's certificate, because that needs the private keyThe half of a key pair that its owner keeps to themselves and uses to create signatures or decrypt data. Anyone who obtains it can act as its owner., so whatever certificate they present has a different thumbprint. The thumbprint covers the whole certificate, not only its key, so even a second certificate made for the same key does not match.
The API does not need to validate the certificate's chain or check who issued it. That was the authorizationDeciding whether a requested action is permitted, such as whether a signed-in account may delete a particular photo. Authentication says which account is asking; authorization decides what it can do. server's job when it authenticated the client. The API only needs to know that this connection was made with the same certificate as the token request, and the handshake has already proved that the client holds the private key for the certificate it presented.
The API does need to request a certificate in the first place. TLS asks for one during the handshake, before the token arrives, so an API cannot decide to ask only when it sees a bound token. APIs that accept certificate-bound tokens usually request certificates on every connection, or serve those requests from a separate host name, as the authorization server did with its aliases.
Binding tokens for a public client
Binding a token and authenticating a client are separate decisions, which lets a client with no credentials use mutual TLS too. The printer's phone app is a public client, as Binding a token to a key described. Instead of a DPoP key, each installation could generate a key pair and a self-signed certificate for it, and use that certificate for mutual TLS with both the photo service's authorization server and its API.
The authorization server sets up its TLS layer as it does for the self-signed method, accepting a certificate no CA has signed, but it does not use the certificate to authenticate the app. Any installation can create one, and nothing about it was registered in advance, so it says nothing about which app is asking. The app sends its client_id without a credential, as any public client does, and the server only binds the tokens it issues to the certificate's thumbprint. The handshake has already shown that the app holds the private key.
Refresh tokens need the same treatment. A confidential client authenticates every time it uses a refresh token, so its refresh tokens are already tied to it. A public client cannot authenticate, so the specification says that an authorization server issuing it a refresh token should bind that token to the certificate as well and check the binding on every refresh. A refresh token copied from Ava's phone is then as useless without the private key as a copied access token, the same protection DPoP gives a public client's refresh tokens.
The arrangement is possible rather than common. Client certificates are awkward in many mobile HTTP libraries, most APIs sit behind proxies, and every API has to request a certificate on every connection. DPoP, which works in ordinary HTTP headers, is usually the easier way to bind a phone app's tokens.
When a proxy ends the TLS connection
Many APIs never see a TLS handshake. A load balancer or reverse proxy in front of them ends the client's TLS connection and forwards each request to the application over a separate, internal connection. For mutual TLS, the proxy is now the party that receives the client's certificate, and it has to pass the certificate along.
It usually does so in a request header. A common header for this, Client-Cert, is described in RFC 9440. It carries the certificate's DER encoding in Base64, between colons:
POST /print-jobs HTTP/1.1
Host: api.printlab.example
Authorization: Bearer demo-lab-access-token-3
Client-Cert: :MIIB+zCCAaCgAwIBAgIGXBp+IgnUMAoGCCqGSM49BAMCMDMx...:
Content-Type: application/jsonThe certificate is shortened here for display. The application computes the thumbprint from this header instead of from its own TLS layer.
That header is now as powerful as the certificate itself, which creates an obvious attack. Someone with a stolen token connects to the proxy, presents any certificate or none, and adds their own Client-Cert header containing the order service's certificate, which is not secret. If the proxy passes that header through, the API sees a perfect match. The mutual TLS specification leaves this hop to each deployment, so the defense is deployment practice, set out in the header's own description and in current security guidance. It comes down to three rules:
- The proxy removes or overwrites any
Client-Certheader that arrives from outside, and sends none at all when no client certificate was presented. - The application accepts the header only from the trusted proxy, never from anything else that can reach it.
- The link between the proxy and the application is protected against eavesdropping and tampering, for example by its own authenticated TLS connection or a private network only the proxy can use.
Skipping the first rule breaks nothing visible. Honest requests still work, so a missing sanitizing step can go unnoticed until someone uses it.
Compared with DPoP
DPoP and certificate-bound tokens solve the same problem from different layers. The table sets the two side by side on the questions that usually decide between them:
| Question | DPoP | Mutual TLS |
|---|---|---|
| Where is possession proved? | In each HTTP request, with a signed proof | In the TLS handshake, once per connection |
| What is the token bound to? | Any key pair the client generates | The client's certificate |
What does cnf hold? | jkt, a JWK thumbprint | x5t#S256, a certificate thumbprint |
| How is the token sent? | The DPoP scheme, with a proof | The Bearer scheme, over a mutual TLS connection |
| Can a captured request be replayed? | Briefly, unless the server tracks identifiers or uses nonces | No. Each connection needs the private key |
| What about proxies? | Proofs pass through unchanged in HTTP headers | A proxy that ends TLS must forward the certificate safely |
| What about browser applications? | Works with keys created in the browser | Impractical, because browsers handle client certificates poorly |
Mutual TLS suits backends that already manage certificates, such as the order service, and its replay protection comes with the connection itself. DPoP suits clients that cannot easily hold certificates, such as the phone app and browser applications. Both make a copied token worthless on its own, and both tie the token to something that will one day be replaced. For a certificate that day is certain, because every certificate has an expiry date.
Check your understanding
Try these questions before moving on. If an answer isn't right, use the feedback and try again.
Try it in the Lab
- Bind an access token to a client certificateCompute your certificate's x5t#S256 thumbprint, get a token whose cnf holds it, and see the photo API accept it only over a connection with that certificate.