Skip to content
Workforce IdentityMarkdown

Certificate-bound tokens

Clients sign in with a TLS client certificate, and their tokens work only over a connection presenting it.

Available, with limitsAPIRFC 8705 §2.2

A client that holds a TLS certificate can sign in with it instead of a secret, and have its tokens bound to it. A bound token works only over a connection presenting that same certificate, so a copy of the token is no use without the certificate’s key. The client registers its public keys, as a key-based client does, and the realm matches the certificate’s key against them: no certificate authority is involved.

Use it for services that already hold TLS certificates, such as those in a mutual-TLS deployment. What’s missing today: only self-signed certificates are accepted. The gateway checks the binding only when the TLS front end before it forwards the client certificate (Bound tokens at the gateway); where yours can’t, bind tokens with DPoP instead.

  • Who can do it: a realm administrator (a group holding RealmOwner); RealmViewer can read the settings but not change them. The client then signs in with its own certificate.
  • Where: today this is done through the API (Call the API shows how to get $CVYUH_SESSION).
  • First: the client holds a self-signed certificate and can send it without being asked (curl and Go do; some SDKs need setting up).

While the realm’s mtls setting is on, each of its hosts has an mtls alias: foobar.cvyuh.com is mtls.foobar.cvyuh.com. A client connects there with its certificate; browsers on the realm’s own host are never asked for one. The issuer is the same at both hosts.

The client asks for a token at the alias, over a TLS connection presenting the certificate. The certificate is the client’s credential, so the form names the client and nothing else:

Terminal window
curl https://mtls.foobar.cvyuh.com/oauth2/token \
--cert payments.crt --key payments.key \
-d grant_type=client_credentials \
-d client_id=payments
{ "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6ImF0K2p3dCJ9.…", "token_type": "Bearer", "expires_in": 300 }

The token names the certificate’s thumbprint in cnf.x5t#S256, and introspection shows it too. The client then calls the realm’s APIs over the same certificate, with the token as a bearer token. Over another certificate, or none, the token is refused.

  1. Turn the realm’s mtls on and offer the method. Read the realm’s settings first: a list you send replaces the realm’s list.

    Terminal window
    curl -X PATCH https://foobar.cvyuh.com/api/v0/am/objects/v1/oauth2Settings/oauth2Settings \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
    -H "Content-Type: application/json" \
    -d '{ "mtls": true, "tokenEndpointAuthMethods": ["…existing methods", "self_signed_tls_client_auth"] }'
  2. Register the client with its keys and the method:

    Terminal window
    curl 'https://foobar.cvyuh.com/api/v0/am/objects/v1/oauth2Client?id=payments' \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
    -H "Content-Type: application/json" \
    -d '{
    "tokenEndpointAuthMethod": "self_signed_tls_client_auth",
    "jwks": { "keys": [ { "kty": "RSA", "n": "…", "e": "AQAB" } ] },
    "tlsClientCertificateBoundAccessTokens": true,
    "grantTypes": ["client_credentials"]
    }'
  3. Have the client ask for its tokens at https://mtls.foobar.cvyuh.com/oauth2/token. The alias answers once its own certificate is issued, moments after you turn mtls on.

ErrorWhyWhat to do
The TLS handshake failsThe client sent no certificateConfigure the client to send its certificate without being asked
invalid_client (401)The certificate’s key isn’t one the client registered, or the realm doesn’t offer the methodRegister the key in jwks or jwksUri; add the method to the realm’s list
invalid_token (401)A bound token came over another certificate, or noneCall over the certificate the token was issued to
invalid_grant (400)A public client’s refresh token came over another certificateRefresh over the same certificate
400 on saveThe client asks for both DPoP and certificate-bound tokens, or has neither or both of jwks and jwksUriChoose one binding, and exactly one key source
409 on turning mtls onAn alias of one of the realm’s hosts is already held by another realmContact support
Setting or limitDefaultRange
mtlsoffon or off, for the whole realm
self_signed_tls_client_auth in tokenEndpointAuthMethodsnot offeredadd it to offer it
tlsClientCertificateBoundAccessTokensoffper client
Certificatesself-signed, holding a registered EC P-256 or RSA 2,048-bit or larger keyfixed today

Each token request is a TOKEN_ISSUED record under the client, issued or refused with its error. Turning mtls on or off, and registering the client, are changes in Audit → Config.

  • The alias is the realm’s while mtls is on. With it off, the alias answers 404. A host beginning mtls. can’t be claimed as a host of its own.
  • A token is bound one way. A client is registered for certificate-bound tokens or for DPoP, never both. A bound token is still token_type: Bearer: possession is proved by the connection.
  • Only a client that asks is bound. Without tlsClientCertificateBoundAccessTokens, a client presenting a certificate gets a plain bearer token. A public client’s refresh tokens are bound too.
  • The discovery document lists the alias (mtls_endpoint_aliases) while mtls is on, unless the realm’s base URL is at a host the realm doesn’t claim, such as your own proxy.
  • A FAPI 2.0 client stays on private_key_jwt with DPoP.
  • Certificates from your own certificate authority (tls_client_auth), checked against trust anchors you provide.