Answers for "How to decode Microsoft Local token in service"

C#
0

How to decode Microsoft Local token in service

// Getting Decoded Token from the HTTP context
// May very according to place where you are using it.
// You can use it in Controller/AttributeFilter/Middlerware.

var identity = HttpContext.User.Identity as ClaimsIdentity;

// Gets list of claims.
IEnumerable<Claim> claims = identity.Claims;

// Can find any value from claim by changing below code
var Name = claims.Where(x => x.Type == ClaimTypes.Name).ToArray();

// Do the next opertaion
Posted by: Guest on August-27-2021

Code answers related to "How to decode Microsoft Local token in service"

C# Answers by Framework

Browse Popular Code Answers by Language