Language

IMsalWsTrustHttpClientFactory.GetHttpClient(Boolean) Method

Definition

Returns a client with automatic redirects disabled and the requested server credential policy. MSAL validates and follows redirects itself.

public System.Net.Http.HttpClient GetHttpClient(bool useDefaultCredentials);
abstract member GetHttpClient : bool -> System.Net.Http.HttpClient
Public Function GetHttpClient (useDefaultCredentials As Boolean) As HttpClient

Parameters

useDefaultCredentials
Boolean

Whether to use the current user's default credentials for server authentication on platforms that support Integrated Windows Authentication. When false, the client must not supply server authentication credentials, including credentials configured by the application. This does not disable authentication to a configured proxy.

Returns

A reusable HTTP client whose handler has AllowAutoRedirect set to false (or the platform equivalent), and UseDefaultCredentials configured according to useDefaultCredentials where supported. All delegating handlers must also leave redirects to MSAL and respect the credential policy.

Applies to