question

33810499 avatar image
0 Votes"
33810499 asked AgaveJoe answered

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?

dotnet-aspnet-core-mvcdotnet-aspnet-core-blazor
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

AgaveJoe avatar image
0 Votes"
AgaveJoe answered

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 WASM
Blazor Server


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.