I'm using AndroidHttpClient in my app. Now I need to use Basic authorization for requests.
http://developer.android.com/reference/android/net/http/AndroidHttpClient.html
In documentation they say I can use HttpRequestInterceptor but I can't figure HOW I can do that. There is no method to add this interceptor. Ideally I wanted to add it like they do here: http://dlinsin.blogspot.com/2009/08/http-basic-authentication-with-android.html
Anyone knows why it doesn't work for me or Google documentation wrong?
Ok, it's not possible and obviously documentation wrong.. Had to go with plain HttpClient to get it to work.
I know the question is old but for the benefit of anyone stumbling on this (like I did), you can roll the header yourself with HttpGet object. Like so :
httpGet.addHeader("Authorization", "Basic " + Base64.encode(username+":"+password));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With