The SDK comes with project templates that include authentication and authorization. I recommend creating a new project using one of the templates. Then review the code to understand how to configure authentication/authorization in a Blazor application.
Blazor Identy using SignInManager from razor page
In blazor server i could add Identity scafold to my project and i used this.
But this is written with cshtml and uses Mvc Logics.
So without knowledge with AspNetCore Mvc i started implementing custom login and out.
The Login page was needed so i used it.
But Logout page is not needed.
So i added a click event and Injected SignInManager
@inject SignInManager<IdentityUser> SignInManager
and called
SignInManager.SignOutAsync();
And... it didn't worked well.
I couldn't use debugger because the error was hidden behind code so i couldn't see.
So. here's a Question.
How can i Use asp net core Functions.
And how can i call them from blazor?
2 answers
Sort by: Most helpful
-
-
Jan Mucha 101 Reputation points
2021-11-05T09:19:58.697+00:00 Hello, SignInManager use Http request resposne communication, but blazor is on web socet communication. For example you cannot use cookies in blazor. SignInManager unfortunatly does not work on blazor.
Try read this article https://startblazoring.com/Blog/SignInManager