public async Task <IActionResult> Login(LoginRequest request) { if (!ModelState.IsValid) { return(View(ModelState)); } var resultToken = await _userClient.Authenticate(request); var userPrintcipal = this.ValidateToken(resultToken); var authProperties = new AuthenticationProperties { ExpiresUtc = DateTimeOffset.UtcNow.AddMinutes(10), IsPersistent = true }; HttpContext.Session.SetString("Token", resultToken); await HttpContext.SignInAsync( CookieAuthenticationDefaults.AuthenticationScheme, userPrintcipal, authProperties); return(RedirectToAction("Index", "Home")); }