How to handle windows authentication in Android

Posted by Anuraj on Monday, March 10, 2014

Android Miscellaneous

If you are developing enterprise applications you may need to handle windows authentication from mobile devices. Windows authentication (formerly named NTLM, and also referred to as Windows NT Challenge/Response authentication) is a secure form of authentication because the user name and password are hashed before being sent across the network. Here is the snippet which helps to handle windows authentication in Android.

webView = (WebView) findViewById(R.id.webView1);
webView.setWebViewClient(new WebViewClient() {
	@Override
	public void onReceivedHttpAuthRequest(WebView view,
			HttpAuthHandler handler, String host, String realm) {
		handler.proceed("DOMAIN\\username", "password");
	}

});

webView.loadUrl("URL");

Happy Programming :)



Did you like this article? Share it with your friends

Facebook Twitter Google+ LinkedIn Reddit StumbleUpon



MVP
Subscribe


Copyright © 2017 - Anuraj P. Blog content licensed under the Creative Commons CC BY 2.5 | Unless otherwise stated or granted, code samples licensed under the MIT license. This is a personal blog. The opinions expressed here represent my own and not those of my employer. Hosted with ❤ by GitHub