Android NTLM authenication made easy

If your android application use any internet resource like a API call or SOAP call ,  behind a corporate proxy you might get a authentication failed message. The issue is because the proxy server is using an authentication mechanism to restrict access. Usually proxies support basic authentication then you can get around with android builtin classes see the sample code


If incase the proxy doesnt support basic authentication and do have NTLM authentication support ( Mostly ISA proxy) you cannot get the authentication to work as easy as before. I have been reading some details on ntlm and few open source implementation of it. I came accross jcif library and found few usefull classes and added few android specific helper classes to make a tiny library.

With the library NTLM authentication is made very simple. Only thing you need to know is you domain name , username and password,Proxy server details if any, add the library to your build path and use NTLM class in net.maxters.ntlm package. Use the static method setNTLM with desired HttpClient and authentication parameters.

few variation of the method is also include where you can explicitly specify the scope, user credentials, proxy details, etc. Methods are


An example for http get would be like


An example for http post would be like



24 thoughts on “Android NTLM authenication made easy”

      1. That’s great thanks this library is exactly what i’ve  been looking for, can i use it freely? giving credit obviously

  1. I am using your NTLM authentication in an internal app at the company I work for. It works great! Is it possible to get the source? I need to satisfy legal, even with an internal app, that there are no open source license files (Apache, LGPL, etc.) we need to include with the app.


  2. hi, i am trying to use your library, but the app stop working when i do the client.execute(post),
    i need to use https, your library works for it?

    1. hi, i havent tested https , i did it long before , right now i dont have access to ntlm protected system as soon as i get one i will post my results

      1. Hi, I have try it with a signed https conexion. So maybe that difficult the process.

        And thanks for your time.

  3. This lib is not working for me unfortunately. In browser the authentication is working and when I tried decoding the tokens exchanged during authentication I found that browser is sending token in NTLMSSP and your code sends it as NTLMSSP2. If you could explain me what might be wrong I would be grateful to you. Thanks…

  4. I got “The method setNTLM(AbstractHttpClient, String, String, String, AuthScope, HttpHost) from the type NTLM is not visible”
    – after adding jar, and importing it to the class.

Comments are closed.