Last Updated: Oct 2, 2024
Overview
This article details how to Get the User ID Token in Auth0-SPA-JS.
Applies To
- auth0-spa-js 12
- ID Tokens
Solution
To get the id_token, use the getUser method. For example, after authentication, call the Auth0 Client like this:
const user = await auth0Client.getUser();
Update: The raw id token is now available via this method:
$('#getIdTokenClaims').click(async () => {
const claims = await auth0.getIdTokenClaims();
// to get the raw id_token, access it
// using the __raw property
const id_token = claims.__raw;
});