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"); } }