NTLM Authentication using RestSharp?

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.

1

4 Answers

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();
4

Try this:

var client = new RestClient(_baseURL)
{ Authenticator = new RestSharp.Authenticators.NtlmAuthenticator()
};

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);

Not supported currently. Refer to the below thread.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like