Certificate rotation and validation
Every client certificateA signed statement that a public key belongs to a name, such as a website's hostname, for stated purposes and a limited period. A certificate authority signs it, so software that trusts the authority can connect the key to the name. expires, and replacing one touches three things at once: the TLS connections the client opens, its authenticationChecking evidence that someone, or some application, controls an account, such as a password or a passkey. It establishes which account is being used, not what that account may do. at the token endpointThe authorization server address where clients exchange an authorization code, refresh token, or other grant for tokens, in a direct request rather than through a browser redirect., and every access tokenA token that a client presents to an API to use access it has been granted, usually limited in what it allows and how long it lasts. It authorizes API calls; it does not tell the client who signed in. 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 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. 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 pairA private key and a public key generated together and mathematically linked. The private key creates signatures and the public key checks them, but the private key cannot practically be worked out from the public one. and asks the print lab's partner CAAn organization that checks who controls a name and then signs certificates for it. Browsers and other software trust a chosen set of authorities, and through them the certificates those authorities issue. 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 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. 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 PKIPublic key infrastructure: certificates, the certificate authorities that issue them, and the rules and systems that manage them, which together let software trust that a public key belongs to a name. 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 setA JSON document, published at a fixed HTTPS address, that lists an issuer's current public keys so others can verify its signatures. It never contains private keys., 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 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 whole certificate:
| Certificate | Valid | x5t#S256 |
|---|---|---|
| Current | 15 September to 14 December 2026 | upcMvPttuVZhYLYqzpqiqONaXZb2mD-2bd4QPsKEw2M |
| Renewed | 30 November 2026 to 28 February 2027 | 3WslWa2R8mrdJ7U93p0Rn-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 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. 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.
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.
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:
| Client | Usual choice | What it costs |
|---|---|---|
| A browser application, such as the photo editor | DPoP with a non-extractable key in the browser, or no binding in the browser at all because a backend for frontend holds the tokens | Nonce 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 app | DPoP with a key in the platform's protected key storage | A 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 frontend | Often 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 service | Mutual 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.
Try it in the Lab
- Rotate a client certificate without an outageRenew the order service's certificate with overlap, see why tls_client_auth needs no registration change while the self-signed method needs add, switch, remove, and move to a new partner CA safely.