[android-developers] AndroidHttpClient HttpGet with Basic Authorization
Hallo,
why I can't add a "Authorization" header field to my get request?
AndroidHttpClient client = AndroidHttpClient.newInstance(useragent);
HttpParams httpParams = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpParams, 15 * 1000);
HttpConnectionParams.setSoTimeout(httpParams, 15 * 1000);
HttpGet get = new HttpGet(url);
get.addHeader("Authorization", "Base64 encoded String");
get.addHeader("Accept", "application/json");
get.setParams(httpParams);
...
When I execute this request I get a "HTTP/1.1 400 Bad Request" response.
When I remove the line "get.addHeader("Authorization", "Base64 encoded
String");" everything works fine (without the authorization).
What's going wrong? Is that the right way to do a basic authorization?
How to add the header field?
Ralph
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home