Skip to content
Workforce IdentityMarkdown

Client attestation

Only approved builds of an app or agent get tokens, because each instance proves which software it is, not only that it holds a key.

AvailableAPIOAuth Attestation-Based Client Authentication (draft)

With attestation, a party you trust vouches for a client’s instance: a vendor’s backend or a platform’s attestation service, called the attester, signs a statement that this instance holds a particular key. The instance presents the statement with a fresh proof signed by that key. A key copied to another machine, or a statement replayed, is not enough to get a token.

Use it where only approved builds of an app or an agent may get tokens. It is one of the client authentication methods, attest_jwt_client_auth, and refresh tokens issued under it stay with the instance that earned them.

  • Who can do it: a realm administrator (a group holding RealmOwner) trusts the attesters and sets the client’s method; RealmViewer can read both. The instance then authenticates itself.
  • Where: today this is done through the API (Call the API shows how to get $CVYUH_SESSION).
  • First: each attester’s issuer name and keys, and an app or agent that can fetch an attestation and sign proofs.

The client sends two JWTs in two headers with its token request:

  • the attestation, from the attester, in OAuth-Client-Attestation;
  • the proof, signed by the instance’s own key, in OAuth-Client-Attestation-PoP.

The attestation’s claims name the attester, the client and the instance’s public key:

{
"iss": "https://attester.example.com",
"sub": "field-app",
"exp": <unix time>,
"cnf": { "jwk": { "kty": "EC", "crv": "P-256", "x": "…", "y": "…" } }
}

The proof’s claims name the realm, and carry the realm’s challenge:

{
"aud": "https://foobar.cvyuh.com/oauth2",
"iat": <unix time>,
"jti": "4c1e9a7b-2f3d-4e5a-8b6c-9d0e1f2a3b4c",
"challenge": "eyJhbGciOi…"
}

1. The first request has no challenge yet, so the realm answers with one:

Terminal window
curl https://foobar.cvyuh.com/oauth2/token \
-H "OAuth-Client-Attestation: eyJhbGciOiJFUzI1NiIsInR5cCI6Im9hdXRoLWNsaWVudC1hdHRlc3RhdGlvbitqd3QifQ.…" \
-H "OAuth-Client-Attestation-PoP: eyJhbGciOiJFUzI1NiIsInR5cCI6Im9hdXRoLWNsaWVudC1hdHRlc3RhdGlvbi1wb3Arand0In0.…" \
-d grant_type=client_credentials \
-d scope=orders.read
HTTP/1.1 400 Bad Request
OAuth-Client-Attestation-Challenge: eyJhbGciOi…
Cache-Control: no-store
{
"error": "use_attestation_challenge",
"error_description": "the proof of possession must carry the server's challenge"
}

2. The client signs a new proof with that challenge in it, and sends the request again. The answer is a normal token response.

A challenge is good for dpopNonceLifetimeSecs (300 seconds by default). The realm seals it rather than storing it.

These steps use the admin API; Call the API shows how to get a session.

  1. Turn the method on and name the attesters the realm trusts, with PATCH https://foobar.cvyuh.com/api/v0/am/objects/v1/oauth2Settings/oauth2Settings: add attest_jwt_client_auth to tokenEndpointAuthMethods, and list each attester in clientAttesters. Read the realm’s settings first with GET on the same address, and send back the whole list with the new value added: a list you send replaces the realm’s list.
  2. On the client (https://foobar.cvyuh.com/api/v0/am/objects/v1/oauth2Client), set tokenEndpointAuthMethod to attest_jwt_client_auth and name its attesters in clientAttesters.
WhereSettingWhat it does
RealmtokenEndpointAuthMethods includes attest_jwt_client_authOff by default
RealmclientAttestersThe attesters the realm trusts, by iss, each by its keys (jwks) or an https jwksUri
RealmtokenEndpointAuthSigningAlgsThe algorithms both JWTs may be signed with (ES256, RS256 by default)
RealmclientAssertionMaxLifetimeSecs, clockSkewSecsHow old a proof may be (300) and the clock tolerance (60)
RealmdpopNonceLifetimeSecsHow long a challenge is good for (300)
ClienttokenEndpointAuthMethod attest_jwt_client_auth, clientAttestersThis client authenticates by attestation, from these attesters (at least one, and only with this method)
ClientsecurityProfileAnything but fapi2. An attesting agent’s client that names none is written oauth2.1
Setting or limitDefaultRange
attest_jwt_client_auth in tokenEndpointAuthMethodsnot offeredadd it to offer it
clientAssertionMaxLifetimeSecs: how old a proof may be3001 to 3,600
clockSkewSecs600 to 300
dpopNonceLifetimeSecs: how long a challenge is good for30010 to 3,600
Uses per proofonefixed
Security profileanything but fapi2fixed
SymptomCauseFix
use_attestation_challenge on the first tryThat’s the design: the proof needs the realm’s challengeRetry with the value from OAuth-Client-Attestation-Challenge
invalid_client for a new buildIts attester isn’t in the realm’s clientAttesters, or not in the client’sTrust the attester on both
invalid_grant on refresh after scaling outAnother instance used the refresh tokenEach instance refreshes only its own tokens
Saving the client is refusedIt names fapi2, or attesters without the methodChoose oauth2.1 or none; set the method

Each token request is a TOKEN_ISSUED record under the client (or its agent), issued or refused with its error. Changes to clientAttesters and the client are in Audit → Config.

  • Only attesters the realm trusts, and only those the client names. A statement from any other is refused invalid_client.
  • The statement is about this client. Its sub is the client ID, it carries an iat no further ahead than the realm’s clock skew, it hasn’t expired (allowing the skew), and the key it vouches for, in cnf.jwk, is a public key. The client is named by that sub: a client_id sent beside it must match it.
  • Each JWT says what it is. The attestation’s typ is oauth-client-attestation+jwt, and the proof’s is oauth-client-attestation-pop+jwt. Both are signed with an algorithm in the realm’s tokenEndpointAuthSigningAlgs.
  • The proof is signed by that key, fresh, and used once. It is addressed to the realm (aud is the issuer, as a single string). Fresh means its iat isn’t ahead of the realm’s clock by more than the skew, and is no older than clientAssertionMaxLifetimeSecs plus the skew.
  • A refresh token stays with its instance. A refresh token issued to an attesting client refreshes only when the same instance authenticates, by the same key. Another instance of the same client is refused invalid_grant, and the token stays usable by its own instance.
  • The two headers travel together, once each. Either header without the other, either sent twice, or a value that isn’t a single token is refused invalid_request.
  • Not under FAPI 2.0. FAPI 2.0 doesn’t allow authentication by attestation, so a client authenticating this way can’t hold the fapi2 profile. Any other profile takes it, including none. An attesting agent’s client that names fapi2 is refused when it is saved (AI agents).
  • Not offered to self-registered clients. Dynamic registration and client metadata documents don’t offer the method.
  • An agent’s attestationType and attestation fields are recorded only, never checked.
  • Access tokens bound to the instance’s key. Today the refresh token is bound to the attested instance; the access tokens it buys are not yet bound to that key.
ErrorWhen
use_attestation_challenge (400)The proof carries no challenge, or one that is no longer current. Retry with the one in OAuth-Client-Attestation-Challenge
invalid_client (401)The attester isn’t trusted or isn’t one the client names; a signature, a typ, a time, the sub or the key doesn’t hold; or the proof was used before
invalid_request (400)A header missing, sent twice or not a single token; a client_id that isn’t the attestation’s sub; or another client authentication method beside it
invalid_grant (400)A refresh token issued to another instance of this client