views:

18

answers:

0

Hi,

I am trying to implement the OpenID + OAuth hybrid protocol in my application for Google. I am getting the request token. So the next step as document in the Federated Login is exchange request token for an access token.

I tried it using OAuth java library but i am not getting the access token. I am trying both the 3-legged and 2-legged approaches not succeed.

Is anyone succeed in doing the hybrid protocol.

    GoogleOAuthParameters oauthParameters = new GoogleOAuthParameters();
        oauthParameters.setOAuthConsumerKey(consumerKey);
        oauthParameters.setOAuthConsumerSecret(consumerSecret);

        calendarService = new CalendarService("marketplace-hello");
        try {
            calendarService.setOAuthCredentials(oauthParameters, 
new OAuthHmacSha1Signer());
            CalendarEventFeed results = calendarService.query(calendarFeedUrl, 
CalendarFeed.class);
        }
 catch (OAuthException e) 
{      
throw new ServletException("Unable to initialize calendar service", e); 
}

This is throwing the com.google.gdata.client.authn.oauth.OAuthException: oauth_token does not exist.

oAuthParameters.setOAuthType(OAuthType.TWO_LEGGED_OAUTH); and xoauth_requestor_id attibute to feedURL if i add these lines in the code i am getting Invalid AuthSub Token exception i don't know why it is saying Invalid AuthSub.