Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

C# .net JwtSecurityTokenHandler jwttoken claims to object

In any controller from net core 2 that has gone through the authorize with the JwtBearerDefaults scheme, you can use:

 [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
 public ActionResult Index()
    {
        var user = User.FindFirst("Name").Value;
        //or if u want the list of claims
        var claims = User.Claims;

        return View();
    }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #JwtSecurityTokenHandler #jwttoken #claims #object
ADD COMMENT
Topic
Name
8+8 =