Take the 2-minute tour ×

I'm using HttpClient 4.0 to get some XML from the remote host. When I use URL such as https://user:pwd@www.somesite.com it works fine in the browser but fails in the HttpClient with this stacktrace (follows). Any suggestions? I'm using SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER while setting ThreadSafeClientConnManager to handle HTTPS requests

The code (partial):

final HttpGet get= new HttpGet(url);
final HttpResponse response = this.client.execute(get);
return new BasicResponseHandler().handleResponse(response);


01-05 22:34:03.783: ERROR/SearchResults(11565): 
    Failed to process request to URL: 
    org.apache.http.client.HttpResponseException: Unauthorized 
share|improve this question

1 Answer 1

up vote 4 down vote accepted

Pass UsernamePasswordCredentials like in this example, not in the URL.

share|improve this answer
Perfect! Thank you very much! –  Bostone Jan 6 '10 at 17:03

Your Answer


