private async Task <HttpClient> CreateHttpClient() { var licensing = await _appSettingsService.GetLicensingSettingsAsync(); if (licensing == null) { throw new Exception("Api Key is empty."); } var client = _httpClientFactory.CreateClient(); client.BaseAddress = new Uri(licensing.ApiAddress); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); return(client); }