public async Task AuthenticateWithToken(TestShippingAuthCredential authCredential) { var authRequest = new ShippingAuthRequest { Name = authCredential.Name, Password = authCredential.Password, PublicKey = authCredential.PublicKey }; var response = await Client.Token.Authenticate(authRequest); if (!response.Success) { throw new Exception($"Shipping auth request responded with: {response.StatusCode} code"); } //reasign client dependency string essUrl = ApiUrlHelper.GetRequesterFormatUrl(_essApiUrl); Client = new ShippingServiceClient(essUrl, _tenantExtId, response.Result, ApiUrlHelper.UrlContainsHttps(_essApiUrl)); //if response is null, then auth is not success var testResponse = await Client.ShippingConfigurations.GetSingle("string"); if (testResponse == null) { throw new Exception("Endpoints are not authenticated"); } }