> On Fri, Jan 23, 2009 at 8:32 AM, Eric (Google) <[email protected]>wrote:
>
>>
>> The Google Data Java client libraru has an OAuth helper class.
>>
>> There's an example here:
>>
>> http://code.google.com/p/gdata-java-client/source/browse/trunk/java/sample/oauth/OAuthExample.java?r=57
>>
>
Well, I followed the example, and as far as I can tell, I'm doing the same
thing, the only difference being that I have my own OAuthService to which I
save the user access token so I can use it again later as needed.
Here is the code:
GoogleOAuthParameters oauthParameters = new GoogleOAuthParameters();
oauthParameters.setOAuthConsumerKey( myUnencodedConsumerKey );
oauthParameters.setOAuthConsumerSecret( myUnencodedConsumerSecret );
oauthParameters.setScope( "http://www.blogger.com/feeds/" );
OAuthSigner signer = new OAuthHmacSha1Signer();
// Retrieve the unencoding token string
String token = oauthService.getToken();
oauthParameters.setOAuthToken( token );
bloggerService.setOAuthCredentials( oauthParameters, signer );
URL feedUrl = new URL( "http://www.blogger.com/feeds/default/blogs"
);
Feed resultFeed = bloggerService.getFeed( feedUrl, BlogFeed.class );
However, I get this error:
<HTML>
<HEAD>
<TITLE>Unknown authorization header</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Unknown authorization header</H1>
<H2>Error 401</H2>
</BODY>
</HTML>
I wonder what's missing...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"OAuth" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/oauth?hl=en
-~----------~----~----~----~------~----~------~--~---