To use Highly Regulated Identity features, you must have an Enterprise Plan with the Highly Regulated Identity add-on. Refer to Auth0 Pricing for details.
Prerequisites
To use JAR, you must first generate an RSA key pair. Then, register the public key with Auth0 as explained in Configure JWT-Secured Authorization Requests. During the authorization code flow, the client application takes the parameters they would like to send to the/authorize
or /oauth/par
endpoints and wraps them in a JSON Web Token (JWT), which they then sign using the private key.
The verifies the signature with your application’s public key. If the signature is valid, the authorization server extracts the request parameters from JAR and processes the request as usual. As a result, the parameter values are guaranteed to come from a known source, and cannot be tampered with or accessed by intermediaries.
Generate the JAR request
To generate a JAR request, you need to first create a JSON Web Token (JWT). Use the Auth0 JWT library to help you generate a in your preferred language.Header
For a JAR request, the JWT header must contain the following fields:alg
: The algorithm used to sign the JWT. Must be either RS256, RS384, or PS256.typ
: The type of JWT. Must be eitherjwt
oroauth-authz-req+jwt
.
kid
field that identifies the key used to sign the JWT. If a kid
is present, Auth0 will look for a public key registered during JAR configuration that has a matching key ID and use that key to verify the JWT’s signature.
Payload
The JWT payload must contain the following claims:iss
: This must contain your app’sclient_id
aud
: This must be your tenant’s domain, with the protocol and a trailing forward slash. For example,https://your_domain.auth0.com/
/authorize
. For example:
client_id
: This must also contain your app’sclient_id
response_type
: Indicates to Auth0 which flow you want to perform. Usecode
for Authorization Code Grant Flow.
audience
, scope
, state
, redirect_uri
, among others.
In addition, the JWT may contain the following optional claims:
iat
: Must be a numeric date.nbf
: Must be a numeric date, representing a time in the past.exp
: Must be a numeric date, representing a time in the future.jti
: Must be a string no longer than 64 bytes.
Generate JWT example
The following JavaScript code sample demonstrates how to build and sign a JWT using JavaScript and the jsonwebtoken library. It outputs the generated JWT to the console:Call the authorization endpoint
To call the/authorize
endpoint using your signed JWT, open a new browser window. Pass your as the client_id
parameter and the signed and URL-encoded JWT as the request
parameter.