1

I'm using msal for angular and AzureAdB2C for authentication/authorization. I would like to get the Authenticated User within a controller if the User is logged in. I'm using the following code snippet which works with the [Authorize] attribute and the route protected: var id = User.FindFirst(ClaimTypes.NameIdentifier)?.Value; However, it returns null when I add the [AllowAnonymous] attribute to the controller. I tried adding the Bearer token to the Authorization header on my API call, but this did not help. If I add the route to the protected list, then it forces the user to login every time. Any way of doing this with latest version of msal-angular / .NET core 3.1?

0 Answers0