On Oct 5, 2006, at 6:31 PM, James M Snell wrote:

The other way is to use the GoogleLoginAuthCredentials:

 Client client = new CommonsClient();

 GoogleLoginAuthCredentials credentials =
   new GoogleLoginAuthCredentials(
     "email", "password", "blogger");

 client.addCredentials(
   "http://beta.blogger.com";,
   null, null,
   credentials);

This will perform the GoogleLogin once and reuse the auth token for each
request.

If I do this, it will invoke Google's ClientLogin service and get an auth string. So far so good.

But on the subsequent request, it will not add the "Authorization" header.

So I tried calling:

client.usePreemptiveAuthentication(true);

What happens then is that HttpClient's BasicScheme class gets the credentials and tries to cast them to UsernamePasswordCredentials and obviously fails.

What am I doing wrong?

        Ugo

Reply via email to