public IActionResult Login([FromBody] Entities.ClientDTOs.UserCredentials userCredentials) { IActionResult response = Unauthorized(); var userFromDb = _repositoryWrapper.UserRepository.GetUserByEmail(userCredentials.Email); var isAuthenticated = false; if (userFromDb != null) { isAuthenticated = userCredentials.VerifyPasswordHash(userFromDb.Salt, userFromDb.HashedPassword); } if (isAuthenticated) { var tokenString = Jwt.BuildToken(_configuration, userFromDb.Role); response = Ok(new { token = tokenString }); } return(response); }