public async Task <IActionResult> Handle(LoginUserRequest request, CancellationToken cancellationToken) { var user = await _userManager.Users.SingleOrDefaultAsync(x => x.UserName == request.Email, cancellationToken); if (user is null) { return(new NotFoundResult()); } var result = await _userManager.CheckPasswordAsync(user, request.Password); if (result) { var token = _jwtTokenService.WriteToken(new Dictionary <string, string> { { ClaimTypes.NameIdentifier, user.Id.ToString() }, { ClaimTypes.Name, user.UserName } }, new JwtTokenMeta(DateTime.UtcNow.AddDays(1), "unidash", "unidash")); return(new OkObjectResult(new LoginUserResponse { AccessToken = token })); } return(new BadRequestObjectResult("Email or password is incorrect")); }