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
Before using JAR, you must:- Generate a RSA key pair
- Register the public key by uploading it to the Auth0 Dashboard as described in Configure JWT-Secured Authorization Requests
How it works
Instead of passing parameters likescope or redirect_uri as plain text in a URL, the client application wraps them into a signed JSON Web Token (JWT) as the request object:
- Signing: The client application signs the JWT using its private key.
- Verification: The Auth0 Authorization Server receives the JWT and verifies the signature using the public key you registered.
- Processing: If valid, the Auth0 Authorization Server extracts the parameters. If a parameter exists in both the JAR and the query string, the value inside the JAR takes precedence.
Generate the JAR request
Use the Auth0 JWT library to generate a in your preferred language.Header
The JWT header tells Auth0 which key and algorithm to use for verification. It must have the following parameters:alg: The algorithm used to sign the JWT. Must be either RS256, RS384, or PS256.typ: The type of JWT. Must be eitherjwtoroauth-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 payload contains the authorization parameters. It must contain the following claims:iss: This must contain your app’sclient_idaud: 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_idresponse_type: Indicates to Auth0 which flow you want to perform. Usecodefor 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.
Code sample: Generate and sign JAR
The following Node.js example uses the jsonwebtoken library to generate and sign a JAR:Call the authorization endpoint
You can send the JAR to the Auth0 Authorization Server in the following ways:- Standard JAR request: Pass the signed JWT as a URL-encoded string in the request parameter.
- Pushed Authorization Request: For enhanced security and to avoid URL length constraints, use PAR.
Standard JAR request
To call the/authorize endpoint using a standard JAR request:
- Open a new browser window.
- Pass your as the
client_idparameter and the signed and URL-encoded JWT as therequestparameter.
Pushed Authorization Request
To call the/authorize endpoint with a pushed authorization request:
- Send the JAR to the
/oauth/parendpoint via a back-channelPOSTrequest. - Auth0 will return a
request_uri, which you can then use to call the/authorizeendpoint as in a regular PAR flow.