© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
2 replies
UltraWelfare

❔ Blazor and Auth - Identity

I'm using Blazor Hybrid (closer to Blazor WASM) for a desktop app therefore I've made my own custom "AuthenticationStateProvider" to specify my own logic.

As far as it seems like I can get the AuthenticationState which includes the ClaimsPrincipal alongside its Identity and claims.
I've put the account's username and id inside claims but they seem to only receive string.

It's a bit cumbersome to use claims to get the id, and then cast it to int (since int is my id type).

Is there any better way to do it ? I was thinking of getting my model directly from my custom authentication state provider (I have a variable
_currentUser
_currentUser
set), but i don't know if that's a good idea
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

identity blazor
C#CC# / help
2y ago
Blazor Web App and auth from separate webApi with Identity
C#CC# / help
3y ago
Blazor - Identity Scaffolding Fails
C#CC# / help
2y ago
❔ Blazor Server - scaffolding Identity error
C#CC# / help
3y ago