Google のアプリケーションに OpenID + OAuth ハイブリッド プロトコルを実装しようとしています。リクエストトークンを取得しています。したがって、Federated Login のドキュメントとしての次のステップは、リクエスト トークンをアクセス トークンに交換することです。
OAuth Java ライブラリを使用して試しましたが、アクセス トークンを取得できません。3本足と2本足の両方のアプローチを試みていますが、成功しません。
ハイブリッドプロトコルの実行に成功した人はいますか?
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);
}
これは com.google.gdata.client.authn.oauth.OAuthException: oauth_token does not exist をスローしています。
oAuthParameters.setOAuthType(OAuthType.TWO_LEGGED_OAUTH); および xoauth_requestor_id 属性を feedURL に追加すると、コードにこれらの行を追加すると、Invalid AuthSub Token 例外が発生します。