public async Task <IActionResult> Authenticate([FromBody] LoginInput userParam) { var user = await _userRepository.Authenticate(userParam.MapTo <User>()); if (user == null) { return(BadRequest(new { message = "Username or password is incorrect" })); } return(Ok(_authService.GenerateToken(user))); }