public async Task <LoginAuthResponseView> Login(LoginAuthView model) { SignInResult result = await _signInManager.PasswordSignInAsync(model.Email, model.Password, false, false); if (!result.Succeeded) { throw new Exception("Invalid Login or password"); } var user = await _userManager.FindByEmailAsync(model.Email); var encodedJwt = await _jwtProvider.GenerateJwtToken(user); var response = new LoginAuthResponseView() { Token = encodedJwt }; return(response); }
public async Task <IActionResult> Login(LoginAuthView model) { var response = await _authService.Login(model); return(Ok(response)); }