ここで少し検索しましたが、私の問題の答えが見つかりませんでした。spring-security-oauth2.0でGoogle APIを使用
burn-sec-oAuth 2.0(1.0.0.RC2a)でoAuthクライアントを実装しています。 beans.xmlを適切に設定した後、私はうれしいことに、有効なトークンを取得して、すべてがうまく見えます。その後、私はカレンダーAPIを使用したい - 私はどのようにカレンダーオブジェクトを取得するための呼び出しを行うか分からない。
私の(関連)の設定:(春-servlet.xml)
<!--apply the oauth client context-->
<oauth:client id="oauth2ClientFilter" />
<oauth:resource id="google"
type="authorization_code"
client-id="<my client id>"
client-secret="<my client secret>"
access-token-uri="https://accounts.google.com/o/oauth2/token"
user-authorization-uri="https://accounts.google.com/o/oauth2/auth"
scope="https://www.googleapis.com/auth/calendar"
client-authentication-scheme="form"
pre-established-redirect-uri="https://ohad.sealdoc.com/oauth2-client/hello" />
<bean id="googleClientService" class="com...GoogleClientServiceImpl">
<property name="butkeDemoRestTemplate">
<oauth:rest-template resource="google" />
</property>
と実装クラス:
要求処理:そう
public class GoogleClientServiceImpl implements DemoService { private RestOperations butkeDemoRestTemplate; @Override public String getTrustedMessage() { String dataUri = "https://www.googleapis.com/calendar/v3/users/me/calendarList?minAccessRole=writer"; Calendar service = butkeDemoRestTemplate.getForObject(dataUri, Calendar.class); return "demo"; } }
がで終了失敗した。ネストされた例外は エラー= "INVALID_REQUEST"、 ましたerror_description = "{エラー= [{ドメインは= usageLimits、 理由= accessNotConfigured、メッセージ=アクセスが構成されていない}]、コードが= 403、 メッセージ=アクセスが設定されていない}"
あります
私は "getTrustedMessage()"で何か間違っていますので、専門家に相談してみてください...私はOAuth2RestTemplateを使いたいのですが、どうすれば使用するべきURIを知ることができますか?検索後(Google)、私はGoogleコードの例しか見つけず、Google oAuthを使用しています(私は使用したくない - 私はクライアントのためにSpring実装を使用したいと思う)
アイデア?
あなたはどこで素晴らしい記事に私をポイントしてくださいでき私はSpring Securityに基づいて独自のOAuthアプリケーションを実装し、Googleをプロバイダとして使用できます。それは本当に感謝します。 –
@Anand最高の記事はSpring-Security-oAuth wikiページだと思います。あなたのクライアントと保護されたリソースを記述するためのすべての詳細があり、IDプロバイダはgoogleなので、保護されたリソースのXMLを設定する必要があります。 https://github.com/SpringSource/spring-security-oauth/wiki/oauth2 – OhadR
ユーザーはどのようにして同意ページにリダイレクトされますか?私はプロバイダとしてOauth2&Googleを使用してユーザー登録を実装しようとしています。 http://stackoverflow.com/questions/20664846/user-registration-login-using-spring-security-oauth-2-0 –