I am using asynhttpClient for basic authentication
http://loopj.com/android-async-http/
that is looj lib..
below is my code:
usernameRandomPassw
I have same problem. I want to use android asynk http, but i not found ntlm auth I found solution: 1)use above answer,download and import jcifs-1.3.17.jar 2)then i download https://github.com/loopj/android-async-http (not JAR file) and import in my project, 3) then in file AsynkHttpClient.java after
httpClient = new DefaultHttpClient(cm, httpParams);
insert
httpClient.getAuthSchemes().register("ntlm", new NTLMSchemeFactory());
httpClient.getCredentialsProvider().setCredentials(
// Limit the credentials only to the specified domain and port
new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT),
// Specify credentials, most of the time only user/pass is needed
new NTCredentials("username", "pass","", "")
);
!!!!!!! then very important you must comment like this
httpClient.addRequestInterceptor(new HttpRequestInterceptor() {
@Override
public void process(final HttpRequest request, final HttpContext context) throws HttpException, IOException {
AuthState authState = (AuthState) context.getAttribute(ClientContext.TARGET_AUTH_STATE);
CredentialsProvider credsProvider = (CredentialsProvider) context.getAttribute(
ClientContext.CREDS_PROVIDER);
HttpHost targetHost = (HttpHost) context.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
// if (authState.getAuthScheme() == null) {
// AuthScope authScope = new AuthScope(targetHost.getHostName(), targetHost.getPort());
// Credentials creds = credsProvider.getCredentials(authScope);
// if (creds != null) {
// authState.setAuthScheme(new BasicScheme());
// authState.setCredentials(creds);
// }
// }
}
}, 0);
that all you need :)