Beta

Create a tenant

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

Certificate rotation and validation

Every client certificate expires, and replacing one touches three things at once: the TLS connections the client opens, its authentication at the token endpoint, and every access token bound to the old certificate. This lesson renews the printer's order service's certificate without an outage, sets out what the print lab's authorization server validates, and ends by choosing a sender constraint for each kind of client.

Renewing without changing the registration

The order service's certificate from Authenticating a client with a certificate expires at the end of 14 December 2026. The print lab issues partner certificates for about three months at a time, so replacing one is routine, and a rotation that handles all three of its effects goes unnoticed. One that forgets any of them stops the evening's print jobs.

All domains, identifiers, and tokens in these examples are fictional. The order service generates a new key pair and asks the print lab's partner CA for a new certificate with the same subject alternative name, orders.printer.example, following the steps Issuing, renewing, and revoking certificates used for a website. The new certificate is valid from 30 November 2026, two weeks before the old one expires, so both work while the change rolls out across the order service's servers.

With tls_client_auth, nothing changes at the authorization server. The registration names the subject to expect, not a particular certificate, so any certificate from a trusted CA that carries orders.printer.example authenticates the client. That is the main convenience of the PKI method.

With self_signed_tls_client_auth, the registration lists the certificates themselves, so the rotation follows the overlap that Rotating client credentials used for signing keys: register the new certificate, wait until the authorization server has the updated key set, switch, and only then remove the old one. Switching first and registering second produces a burst of invalid_client errors.

The trust side changes occasionally too. If the print lab replaces its partner CA, its authorization server must trust the new CA before any partner receives a certificate from it, and keep trusting the old one until the last certificate it issued has expired.

Tokens bound to the old certificate

Each certificate has its own thumbprint, because the thumbprint is a hash of the whole certificate:

The order service's two certificates and their thumbprints
CertificateValidx5t#S256
Current15 September to 14 December 2026upcMvPttuVZhYLYqzpqiqONaXZb2mD-2bd4QPsKEw2M
Renewed30 November 2026 to 28 February 20273WslWa2R8mrdJ7U93p0Rn-UW1VNnTzwl6yxm4CGQ7Lc

Even a renewal for the same name with the same key would produce a new thumbprint, because the serial number and dates differ. So the moment one of the order service's servers starts connecting with the renewed certificate, any token it holds that was bound to the old one fails at the API with invalid_token. The API is doing exactly what it should: the certificate on the connection is not the one the token names.

The fix is the same as for an expired token. The order service requests a new access token over a connection that uses the new certificate, and retries. On 1 December the replacement's claims include the following, with only the claims that changed shown; 1796151600 is 19:00 UTC on 1 December 2026:

{
  "client_id": "printer-orders",
  "iat": 1796151600,
  "exp": 1796152500,
  "jti": "demo-lab-token-id-4",
  "cnf": {
    "x5t#S256": "3WslWa2R8mrdJ7U93p0Rn-UW1VNnTzwl6yxm4CGQ7Lc"
  }
}

Cached token, current certificate

Connection
upcMvPtt...
Token cnf
upcMvPtt...
Match
Yes

Job accepted

Cached token, renewed certificate

Connection
3WslWa2R...
Token cnf
upcMvPtt...
Match
No

invalid_token

New token, renewed certificate

Connection
3WslWa2R...
Token cnf
3WslWa2R...
Match
Yes

Job accepted

A client can avoid the failed request entirely by keeping its cached tokens alongside the certificate they were obtained with.

After renewal, a cached token bound to the old certificate fails on the renewed connection. A fresh token from the renewed certificate names the new thumbprint and works.

A client can avoid the failed request entirely by keeping its cached tokens alongside the certificate they were obtained with. When a server switches certificates, it discards the tokens bound to the old one instead of trying them first. This matters most when several servers share a token cache but switch certificates at different times.

The order service has no refresh token to think about, because with client credentials it simply asks for a new access token. A confidential client that does hold refresh tokens keeps them through a rotation. The authorization server ties those refresh tokens to the client, which must authenticate every time it uses one, rather than to a particular certificate, so after authenticating with its renewed certificate the client keeps refreshing, and each new access token comes back bound to the new certificate. A public client has no such flexibility. When a server binds its refresh token to its self-signed certificate, as Certificate-bound access tokens described, changing the certificate makes the refresh token unusable, and the app has to send Ava through a new authorization.

Watching expiry

An expired client certificate fails early and quietly. The handshake is refused before any HTTP request is sent, so the order service sees a connection error rather than an OAuth error, and its logs may never mention the token endpoint at all.

Renewal should be automated, as it is for server certificates, and the automation itself needs watching. The order service keeps an inventory of its client certificates with their expiry dates and raises an alert well before each one, independently of the renewal job. That includes certificates it depends on but does not control, such as the partner CA's own certificate.

A leaked private key needs a faster path. The order service obtains a new certificate and asks the CA to revoke the old one. The PKI method leaves revocation checking to each authorization server's discretion, so the print lab may not notice the revocation by itself. Short certificate lifetimes, and the ability to suspend a client registration until a new certificate is in place, are the dependable controls. Tokens bound to the leaked certificate stay usable by whoever holds the key until they expire, so the print lab should also revoke those tokens where it can.

What the authorization server validates

For tls_client_auth, the print lab's TLS layer and its OAuth layer share the work:

  1. The handshake proves the client holds the private key for the certificate it presented.
  2. The certificate chains to a trust anchor configured for client certificates, here only Printlab Partner CA 1, and not to the general set of public CAs a browser trusts.
  3. Each certificate in the chain is within its validity period, the client certificate permits TLS client authentication, and the issuers are permitted to act as CAs.
  4. Revocation is checked, if this deployment checks it.
  5. The registration for the client_id in the request uses this method, and the one subject value it names matches the certificate exactly.

The second step is easy to get wrong. If the server trusted every public CA for client authentication, anyone who could get one of them to issue a certificate naming orders.printer.example, through a mistaken issuance or a briefly hijacked DNS name, could authenticate as the printer. Limiting client authentication to a small set of CAs whose issuing practices the print lab has accepted closes that path. The subject comparison needs care too. Distinguished names can be written in more than one equivalent way, so they have to be compared with consistent matching rules, not as raw strings.

For self_signed_tls_client_auth, there is no chain to build and no CA to trust. The handshake proves possession of the key, and the server checks that the certificate is exactly one of those registered for the client.

Certificate parsing and chain validation have a long history of subtle bugs, and the specification advises using an established, well-tested TLS or X.509 library rather than writing these checks by hand. The API's job stays much smaller: it compares one thumbprint and leaves the rest to the authorization server that issued the token.

Choosing a sender constraint

The order service uses certificates because it already had them. The phone app uses DPoP because it could make a key on the spot. Other clients face the same choice, and sometimes the right answer is neither. The kind of client usually decides it:

A sender constraint for each kind of client
ClientUsual choiceWhat it costs
A browser application, such as the photo editorDPoP with a non-extractable key in the browser, or no binding in the browser at all because a backend for frontend holds the tokensNonce handling in the page, a key the browser may delete, and no protection while injected script runs. Mutual TLS is impractical, because the page cannot choose a client certificate.
A native app, such as the phone appDPoP with a key in the platform's protected key storageA nonce kept for each server, and a retry whenever one changes. A self-signed certificate works too, but client certificates are awkward in many mobile HTTP libraries.
A backend for frontendOften no binding, because its tokens stay on servers it controls. DPoP or mutual TLS where its tokens cross networks it does not control.A key stored on the server, and new checks at every API that receives its tokens.
A service client, such as the order serviceMutual TLS where certificates are already issued and renewed automatically, since one certificate both authenticates the client and binds its tokens. DPoP where TLS ends at proxies that cannot forward a certificate safely.Certificate issuance, renewal and monitoring, and APIs that request a certificate on every connection. With DPoP, replay tracking that every server instance shares.

Behind those rows sit four practical costs. TLS-terminating proxies are the first question for mutual TLS: every proxy between the client and the API must forward the certificate under the rules from Certificate-bound access tokens, while a DPoP proof passes through untouched and the API only has to compare htu with its public address. Nonce and replay storage is DPoP's cost: a server that tracks jti values or issues nonces needs state its instances share, which mutual TLS never needs because the connection itself is the proof. Key storage applies to both. A DPoP key lives with each installation and needs no paperwork, while a certificate needs a CA, an inventory and the renewals this lesson described. Browser support settles the browser row: the Web Cryptography API gives a page a key it can sign with, and nothing comparable lets a page manage client certificates.

Leaving tokens unbound is still a reasonable choice where they never leave servers you control and expire quickly. A binding protects a token only at APIs that check it, as Validating proofs at the server pointed out, so adopting one means changing every API that receives those tokens. Where tokens pass through browsers, phones or networks you cannot see into, that work is what turns a copied token from a credential into a useless string.

Check your understanding

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

The order service switches to its renewed certificate while it still holds a token bound to the old one. What should it expect? 1 of 3

Choose one answer.

Why should an authorization server trust only a small set of CAs for tls_client_auth, rather than every public CA? 2 of 3

Choose one answer.

The photo editor runs entirely in Ava's browser and holds its own tokens. Which way of binding them fits it best? 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