Skip to main content

Private key JWT client authentication

Use the private_key_jwt method to authenticate a client by signing a JSON Web Token (JWT) with an asymmetric key. The authorization server verifies the JWT using the client's public key.

Prerequisites

Before using private_key_jwt, ensure the following:

Authentication flow

  1. The client prepares a signed JWT with the following claims:
ParameterDescriptionRequired
issIssuer - set to the client_idYes
subSubject - set to the client_idYes
audAudience - set to the token endpoint or issuer URL of the authorization serverYes
jtiUnique JWT ID to prevent replay attacksYes
iatIssued-at time in UNIX secondsYes
expExpiration time in UNIX secondsYes

Audience (aud) parameter details

Note: The following values help identify the correct token endpoint.

  • {tid} represents the tenant ID
  • {aid} represents the authorization server ID

Examples:

  • https://{tid}.us.connect.secureauth.com/{tid}/{aid}
  • https://{tid}.us.connect.secureauth.com/{tid}/{aid}/oauth2/token

For certificate-bound tokens, use the MTLS version:

  • https://{tid}.mtls.us.connect.secureauth.com/{tid}/{aid}
  • https://{tid}.mtls.us.connect.secureauth.com/{tid}/{aid}/oauth2/token

Example JWT payload:

{ 
"iss" : "YzEzMGdoMHJnOHBiOG1ibDhyNTA=",
"sub" : "YzEzMGdoMHJnOHBiOG1ibDhyNTA=",
"aud" : "https://{tid}.us.connect.secureauth.com/{tid}/{aid}",
"jti" : "a3a2fc6e-29e3-4b4d-9284-615982c213c4",
"iat" : "1516238941",
"exp" : "1516239022"
}
  1. Sign the payload with the client's private key to generate the JWT.

  2. Send a token request to the authorization server:

ParameterValueRequired
grant_typeclient_credentialsYes
client_assertion_typeurn:ietf:params:oauth:client-assertion-type:jwt-bearerYes
client_assertionThe signed JWTYes

Example request:

curl --request POST \
-F "grant_type=client_credentials" \
-F "client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer" \
-F "client_assertion=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..." \
--url "https://{tid}.us.connect.secureauth.com/{tid}/{aid}/oauth2/token" \
--header 'accept: application/x-www-form-urlencoded'
  1. The authorization server validates the request, verifies the JWT using the public key, and issues an access token.

When to use private_key_jwt

Use the private_key_jwt for high-security client authentication scenarios. It is recommended for organizations that follow Financial-grade API (FAPI) standards.