I just noted that by default, the .NET SDK is made to use no proxy (unfortunately RestSharp seems different in that respect than HttpClient). If you make a request in an environment that needs a proxy, instead of getting a useful error back, you get a System.ArgumentException: 'Value cannot be null. (Parameter 'source')'
bubbling up from AuthExtensions.CallTokenApi
from this call
apiClient.Configuration.Logger.Trace(method.ToString(), url, postBody, statusCode, headerParams, response.Headers.Select(header => new { Name = header.GetType().GetProperty("Name").GetValue(header), Value = header.GetType().GetProperty("Value").GetValue(header) })
.ToDictionary(header => header.Name.ToString(), header => header.Value.ToString()));
if response.Headers
is empty, you get the exception.
May I humbly request this (and the two subsequent logging lines that have the same issue) be rewritten to handle the case where response has no headers?
if I skip the logging code, I get a much more useful exception:
PureCloudPlatform.Client.V2.Client.ApiException: 'Error calling PostToken: The proxy tunnel request to proxy 'http://myproxy.com:8080/' failed with status code '407'."'
Now that's a lot more useful, no?