Retrive ID Token from Auth0-React

I have working on an application where we use Auth0 to handle complete user authentication. In this case, We do not consume any Auth0 API onbehalf of the user but just authentication. Once the user successfully signed-in, we need to fetch IdToken and append it with each backend API request. Since the IdToken is enough for authentication, We do not need the AccessToken.

The problem is, I can get AccessToken using getAccessTokenSilently() but there is no such method to get IdToken. Is there any workaround?

Hi @badpiggie,

Welcome to the Auth0 Community.

The getSession() method provides you with the session data which contains a TokenSet from which you can retrieve both, the access token and the id token.

If you have any other question feel free to reach out.

Have a good one,
Vlad