public async Task <string> Login(LoginRequest request) { var account = await _accountsService.GetFullAccountByEmail(request.Email).ConfigureAwait(false); if (account == null) { throw new Exception("Login failed"); } var valid = IntegraTestEncryption.IsCorrectPassword(request.Password, account.PasswordHash); if (!valid) { throw new Exception("Login failed"); } return(JwtHelpers.CreateJwt(new JwtRequest() { UserEmail = account.Email, UserId = account.Id })); }