Sunday, April 1, 2012

Re: [android-developers] AndroidHttpClient HttpGet with Basic Authorization

You need to add "Basic" in front of the "Authorization" parameter (if
you are using basic auth.). The base64 encoded string also needs both
username and password.

This is from a working example:

method.addHeader("Authorization", "Basic " + Base64.encodeBytes(new
String(this.username + ":" + this.password).getBytes()));

The Base64.encodeBytes helper method is found here: http://iharder.net/base64


On Mon, Apr 2, 2012 at 3:10 AM, Nikolay Elenkov
<nikolay.elenkov@gmail.com> wrote:
> On Mon, Apr 2, 2012 at 4:15 AM, Ralph Bergmann | the4thFloor.eu
> <ralph@the4thfloor.eu> wrote:
>> found an example
>>
>> http://www.android-dev-faq.com/2011/11/how-to-make-httpdigest-client.html
>>
>
> The implementation in Android is however broken: it uses a fixed nonce of 1.
> If you server is actually checking for replay requests, you might get errors.
>
> --
> 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

--
Michael Banzon
http://michaelbanzon.com/

--
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


Real Estate