USING System.Threading.Tasks; USING Microsoft.AspNetCore.Components; USING Microsoft.JSInterop; USING ApprovementWorkflowSample.Applications; USING Microsoft.AspNetCore.Identity; USING System.Security.Claims; USING Microsoft.AspNetCore.Components.Authorization; USING Microsoft.AspNetCore.Authentication.Cookies; namespace ApprovementWorkflowSample.Views { public partial class SignIn { [Inject] public IJSRuntime? JSRuntime { GET; init; } [Inject] public NavigationManager? Navigation { GET; init; } [Inject] public IApplicationUserService? ApplicationUsers{GET; init; } [Inject] public SignInManager<ApplicationUser>? SignInManager { GET; init; } [Inject] public IHostEnvironmentAuthenticationStateProvider? HostAuthentication { GET; init; } [Inject] public AuthenticationStateProvider? AuthenticationStateProvider{GET; init; } ... public async Task StartSigningIn() { ... ApplicationUser? USER = await ApplicationUsers!.GetUserByEmailAsync(Email); IF(USER == NULL) { await HandleSigningInFailedAsync("Email or Password are not match"); RETURN; } SignInResult loginResult = await SignInManager!.CheckPasswordSignInAsync(USER, Password, FALSE); IF(loginResult.Succeeded == FALSE) { await HandleSigningInFailedAsync("Email or Password are not match"); RETURN; } IF(loginResult.Succeeded) { ClaimsPrincipal principal = await SignInManager.CreateUserPrincipalAsync(USER); SignInManager.Context.User = principal; HostAuthentication!.SetAuthenticationState( Task.FromResult(NEW AuthenticationState(principal))); // IF you don't need doing anything without moving to next page, you can remove this. AuthenticationState authState = await AuthenticationStateProvider!.GetAuthenticationStateAsync(); Navigation!.NavigateTo("/Pages/Edit"); } }