Adventures with Blazor: Accessing Claims in a Razor Page


With Blazor Web Assembly officially released I decided to take one of my side projects and write the front end in Blazor.

I was able to wire up Azure AD B2C for authentication.

What I wanted to do next was to take a look at the Claims that were available, I knew how to do this in ASP.NET MVC, but struggled with how to accomplish this with Blazor Web Assembly.

Finally stumbled across this article, ASP.NET Core Blazor authentication and authorization.

There are three ways to do it.

I created a Profile.razor page that demonstrates the three was to achieve this, the code should be below.

I am sure there are other ways, and maybe better ways, so would appreciated any feedback!


Leave a Reply

Your email address will not be published.