I need to get the nameidentifier from the token that Azure AD sends. I am assuming this is unique for each user of the AD and have some custom authorization logic based on it. For example,
AuthenticationResult result = authenticationContext.AcquireToken(webApiResourceId, certificateCredential);
string accessToken = result.AccessToken;
This accessToken is sent to the WebAPI as AuthenticationHeader, that decrypts it and fetches the nameidentifier as
Claim tenantClaim = ClaimsPrincipal.Current.FindFirst(ClaimTypes.NameIdentifier);
But this process on the WebAPI is transparent and is performed by ADAL.However, i need to get the NameIdentifier at client side itself. Is there any way I can fetch the NameIdentifier at client side itself, by decrypting the AccessToken? I do not seem to find the correct answer upon searching.