© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
1 reply
malkav

Authentication Flow Blazor

Can someone help me understand the Blazor Authentication flow, I want to call the database and set the user into a LoggedInUserState, but the <Authentication Action=@Action /> component has some strange order of business, I want to wait till the login process is done, then make the user wait while fetching data, so I can call the graph, then when that's done, call the database, and store graph data in the user if it doesn't already exist, and then set that user in the state.

but right now what I see in the console is:
GET graph.me (401)
GET graph.me (success)
GET login.microsoft.com/token/v2.0/.well-known/openid-configuration
GET graph.me.photo.$value (401)
GET graph.me.photo.$value (success)
GET databaseCall (without graph.me.Id, so I am missing a step apparently)
Unexpected character encountered while parsing value: <. Path: '', line 0, position 0
Unexpected character encountered while parsing value: <. Path: '', line 0, position 0

POST login.microsoft.com/token/oauth2/v2.0/token
Object reference not set to instance of object
Object reference not set to instance of object
(which is kind of obvious as there hasn't been a user set to LoggedInUserState yet)


So how can I best approach this?
I've got the GraphServiceClient setup as per the Blazor examples, as well as the UserClaimsBase, and the UserProfileBase, which I've chained together because I need to call the ClaimsBase first, and then the ProfileBase to set the User from the graph, and then I can use that ID to actually start working on the rest. But right now there's something wrong with the flow, and I can't figure out where the flow starts or ends 😅 help please

https://github.com/Azure-Samples/ms-identity-blazor-wasm/tree/main/WebApp-graph-user/Call-MSGraph/blazorwasm-calls-MS-graph

Git repo for reference.
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

Blazor WASM Authentication
C#CC# / help
2y ago
WebAPI authentication with Blazor WASM
C#CC# / help
8mo ago
❔ Authentication with blazor pre-rendered
C#CC# / help
3y ago
✅ Weird issue with authentication flow
C#CC# / help
9mo ago