nonce
query string parameter in the authentication request, and included in the response from Auth0. This allows applications to correlate the ID Token response from Auth0 with the initial authentication request.
To learn more about where to include the nonce, see Add Login Using the Implicit Flow with Form Post.
Auth0.js manages
state
and nonce
parameters for you when using cross-origin authentication.Generate a cryptographically random nonce
One way to generate a cryptographically random nonce is to use a tool like Nano ID or similar. This does require you to bundle the tool with your JavaScript code, however. If that’s not possible, you can take advantage of the fact that modern browsers can use the Web Crypto API to generate cryptographically secure random strings for use as nonces.Persist nonces across requests
The generated nonce must be persisted in your web application using any of the following methods:HttpOnly
- HTML5 local storage value
Validate ID token
Once Auth0 responds with an ID Token, this token must be validated and decoded as usual. Itsnonce
claim must contain the exact same value that was sent in the request.
If not, authentication should be rejected by the application.