How to add roles to the asp identity bearer token

access-tokenasp.netasp.net-web-apibearer-tokenuser-roles

I implemented OWIN bearer token authorization, and based on this article: http://bitoftech.net/2014/06/01/token-based-authentication-asp-net-web-api-2-owin-asp-net-identity/, and now i want to add roles to the bearer token so that i can be able retrieve it on the controller like am doing with the userName…identity.AddClaim(new Claim(ClaimTypes.Name, context.UserName)); and was able to get the username of the current user with User.Identity.Name

Best Answer

Check my latest post on bitoftechwhere I read Roles once I generate token, or you can assign roles manually using the ClaimsType.Role like you assign the UserName. Hope this answers your question.