Blazor Api call in OnInitializedAsync() with auth and UserMiddleware crash #52350
Closed
1 task done
Labels
area-blazor
Includes: Blazor, Razor Components
Is there an existing issue for this?
Describe the bug
When I call an api from a blazor page I think my middleware crash and I don't understand why
If the api call is called inside OnInitializedAsync it doesn't work, when it's trigger by the Hello button outside of OnInitializedAsync it works.
I wait the authenticatioState correctly I think.
It crash server side in my user middleware, when I set my user
(like explained here https://learn.microsoft.com/en-us/aspnet/core/blazor/security/server/additional-scenarios?view=aspnetcore-8.0) to be able to inject my user in other services server side.
Very strange.
Expected Behavior
Same behavior as calling the API with a button click... I'dont understand why my middleware creates this issue for OnInitializedAsync. It crash on await next(context);
Steps To Reproduce
No response
Exceptions (if any)
it returns
.NET Version
8.0
Anything else?
No response
The text was updated successfully, but these errors were encountered: