Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

generate jwt token authorize(roles = admin ) not working .net core 403

var claims = new List<Claim>
            {
                new Claim(JwtRegisteredClaimNames.Sub, user.UserName),
                new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()),
                new Claim(ClaimTypes.NameIdentifier, user.Id),
                new Claim(ClaimTypes.Role,"The Role Of the logged in user, you can get from your DB")
            };
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #generate #jwt #token #admin #working #core
ADD COMMENT
Topic
Name
5+4 =