public static SEVClient CreateSession(bool firstTry = true) { var configuration = new ConfigurationBuilder() .AddJsonFile("SEV.TestConsole.json", optional: true, reloadOnChange: true) .Build(); var sevClient = new SEVClient(configuration["UserName"], configuration["Password"]); if (!string.IsNullOrEmpty(sevClient._userName) && !string.IsNullOrEmpty(sevClient._password) && firstTry) { Console.WriteLine($"Start login for user { sevClient._userName }"); session = SessionConfig.GetSessionConfigAsync(sevClient._userName, sevClient._password).Result; } else { Console.WriteLine("Enter your API user name:"); string userName = Console.ReadLine(); Console.WriteLine("Enter your API password:"******"Login failed incorrect user name or password!"); Console.WriteLine("Please try again."); ActionSeporator(); session = null; CreateSession(false); return(sevClient); } ActionSeporator(); Console.ForegroundColor = CCSuccesful; Console.WriteLine("Login successfully"); ActionSeporator(); return(sevClient); }