I am trying to use NTLM authentication for my REST calls to TeamCity using RestSharp.
IRestClient _client=new RestClient(_url);
_client.Authenticator = new NtlmAuthenticator
(System.Net.CredentialCache.DefaultNetworkCredentials);
However it is not working. Please suggest if I am missing something.
This now appears to be working properly and can be done very easily utilizing the NTLMAuthenticator like so:
RestClient client = new RestClient(_baseURL);
client.Authenticator = new NtlmAuthenticator();
Try this:
var client = new RestClient(_baseURL)
{
Authenticator = new RestSharp.Authenticators.NtlmAuthenticator()
};
Not supported currently. Refer to the below thread.
As of RestSharp v107, The NtlmAuthenticator is deprecated .
This worked for me:
var credentials = new NetworkCredential(username, password, domain);
var options = new RestClientOptions(_settings.ServiceEndPoint)
{
UseDefaultCredentials = false,
Credentials=credentials
};
var client = new RestClient(options);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.