ASPNET Core WEB API access custom claim

Hey,

Let’s say I’m adding a custom claim in a rule that goes something like this.

context.idToken[namespace + ‘UserId’] = result[0].UserId;

How do I then access this claims value in my DOT NET CORE Web API?

Cheers

:wave: @ryrygibbs were you able to access the claims in the end? I believe we can handle custom claim that you added to the token (via your Rule), by configuring the ConfigureServices method in the Startup.cs

OnTokenValidated = context =>
                    {
                        ClaimsIdentity identity = context.Principal.Identity as ClaimsIdentity;

                        var userRoles = identity.FindAll("YOUR_NAMESPACE_FOR_THE_CLAIM"); 
...
                   }
...