Sam
Sam

Reputation: 30388

Handling id_token in ASP.NET Core API

I'm implementing Auth0 with my ASP.NET Core 2.1 app with React front end.

After the user authenticates, I do get both an access_token and an id_token. I'm clear that I send the access_token in the header to gain access to my API methods but I'm not sure how to handle the id_token.

Do I place the id_token in the header as well? If so, what key do I use for it? I'm sending the access_token with the key Authorization -- see below. enter image description here

Not sure how to send the id_token and would appreciate some pointers on this. Thanks.

Upvotes: 5

Views: 815

Answers (1)

sakura-bloom
sakura-bloom

Reputation: 4594

You would use id_token to construct the User object in SPA application and access_token is used to access the API. So, you don't put the id_token in the header.

There is a JavaScript library for Auth0 that can help with authentication/authorization tasks: Auth0.js.

The library may help with constructing the user object and refreshing the access token.

Upvotes: 2

Related Questions