Is there an equivalent to ServerCertificateCustomValidationCallback in the following code snippet? var tokenResponse = $"{baseUrl}/oauth2/token".PostToUrl(login).FromJson<LoginResponse>();
The server at baseUrl is an internal machine at a client’s site, so the SSL certificate is reported as invalid.
Not from the HTTP Utils API as this needs to be configured in the custom HttpClientHandler when constructing the HttpClient instance, e.g:
var handler = new HttpClientHandler {
ServerCertificateCustomValidationCallback = ...
};
var client = new HttpClient(handler);
var response = await client.GetAsync($"{baseUrl}/oauth2/token");
string tokenResponse = await response.Content.ReadAsStringAsync();
If you’re using .NET 6+ you can configure the HttpClientHandler used by all HttpUtils APIs with: