I am using Asp.net Identity Core and made some claims in "AspNetUserClaims". Now I am wondering if I should add all these claims to the JwtSecurityToken when a user logs in?
Or should I be grabbing them another way?
I am using Asp.net Identity Core and made some claims in "AspNetUserClaims". Now I am wondering if I should add all these claims to the JwtSecurityToken when a user logs in?
Or should I be grabbing them another way?
Usually we store identifier claims like userid/username , role info like guest/admin in JWT tokens . You can click here for more details about claims in JWT token.
You can add user's claims which are small , important to your client to JWT token . If doing that , be careful with the size and better not include sensitive information.
But I would recommend not to keep the user profile info into claims . You can use the token to make Api call on server to get the user's profile information by looking up the database .