public async Task <IActionResult> Login([FromBody] LoginDTO loginModel) { if (!ModelState.IsValid) { BadRequest(); } var result = await accountBusiness.Login(loginModel); if (!result.Succeeded) { var errors = result.Errors.Select(x => x.Description).ToList(); _logger.LogWarning(LogEvents.Register, "login errors: {errors} for user: {email}", errors, loginModel.Email); return(BadRequest(errors)); } // generte token var token = await accountBusiness.GenerateJwtToken(loginModel); return(Ok(new { accesToken = token })); }