スクライブで行われたoauthをGdataサービスと組み合わせる方法を知っている人はいますか:
したがって、スクライブで認証した後、アクセストークンを取得し、それを gdata ContactsService のインスタンスにプッシュする必要があります (他のサービスでも同じように機能すると思います)。
シンプルにやってみた
GoogleCredential credential = new GoogleCredential();
credential.setAccessToken(accessTokenString);
ここで、accessTokenString は、実行後にスクライブから取得された文字列です
Token accessToken = service.getAccessToken(requestToken, verifier);
しかし、それはリクエストを実行する際に例外を除いて機能しませんでした:
Exception in thread "main" java.lang.NullPointerException: No authentication header information
at com.google.gdata.util.AuthenticationException.initFromAuthHeader(AuthenticationException.java:96)
at com.google.gdata.util.AuthenticationException.<init>(AuthenticationException.java:67)
at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:608)
at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:564)
at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:560)
at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:538)
at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:536)
at com.google.gdata.client.Service.getFeed(Service.java:1135)
at com.google.gdata.client.Service.getFeed(Service.java:998)
at com.google.gdata.client.GoogleService.getFeed(GoogleService.java:645)
at com.google.gdata.client.Service.getFeed(Service.java:1017)
スクライブの準備ができているので、スクライブと gdata を組み合わせるとよいでしょう。gdata は、Google からのデータを処理するためのより優れた API を提供します。
ありがとう