.netasp.net-web-apijwtangular2-jwt

Update JWT Token .net Core Web API to add new Claims


I am using JWT token for Web API created using .Net core 2.0 and using them with Angular 7.User will have different permissions for each project and user can switch projects without logout. I want to update claims of user while he change his project so permissions related to that particular project can be changed.Is it possible to update/add the claims of JWT token.

Or any better way to achieve this.

Regards,


Solution

  • JWT Tokens are signed based on the data they contain. So therefore if you want to change the data within them, a new token must be issued. You have two options, issue a single token with all the claims for all your apps, or, issue individual tokens for each app seperately.