Google+ API OAuth2 トークンに問題があります。
OAuth2 アクセス トークンを取得する簡単なプログラムを次に示します。
HttpClient httpclient = new HttpClient();
        PostMethod postMethod = new PostMethod("https://accounts.google.com/o/oauth2/token");
        NameValuePair[] data = {
                new NameValuePair("client_id", "API KEY HERE"),
                new NameValuePair("redirect_uri", "URL HERE"),
                new NameValuePair("client_secret", "SECRET HERE"),
                new NameValuePair("code", "CODE HERE"),
                new NameValuePair("grant_type", "authorization_code")
        };
        postMethod.setRequestBody(data);
        try {
            int result = httpclient.executeMethod(postMethod);
            assertEquals(result, 200);
            System.out.println("Response body: ");
            System.out.println(postMethod.getResponseBodyAsString());
        } catch (IOException e) {
            e.printStackTrace();
        }
これにより、OAuth2 トークンが正常に生成されます。例: ya29.AHES6ZTZgptKHyZ530MoYVDPaeXvjK5DWQzPqxoNNEL2C7gsQwGfmvfT8Q
次に、そのトークンから /people API の呼び出しをテストできる簡単なテスト プログラムをセットアップします。
@Test
    public void testGoogleAPIAuthdRequest() throws Exception {
        String feedUrl = "https://www.googleapis.com/plus/v1/people/me";
        String apiKey = "MY API KEY";
        String oauthCode = "OAUTH CODE FROM ABOVE";
        String jsonStr = executeGoogleFeed(feedUrl, apiKey, oauthCode).getResponseBodyAsString("UTF-8");
    }
    public Response executeGoogleFeed(String feedURL, String apiKey, String oauthCode) throws Exception {
        StringBuilder urlStr = new StringBuilder();
        urlStr.append(feedURL);
        urlStr.append("?key=");
        urlStr.append(apiKey);
        Map<String, String> hashMap = new HashMap<String, String>();
        hashMap.put("Authorization", "Bearer " + oauthCode);
        return HttpUtil.doHttpRequest(urlStr.toString(), MethodType.GET.toString(), null,
                hashMap);
    }
これにより、401エラーが発生します。アクセス拒否。
https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=INSERT_ACCESS_TOKENにアクセスすると、トークンが有効であると表示されます。
また、https: //developers.google.com/+/api/latest/people/get にアクセスして OAuth2 サインオン機能から OAuth トークンを取得すると、その OAuth トークンを JUnit テストにプラグインします。 ... できます!
https://accounts.google.com/o/oauth2/tokenへの呼び出しをGoogle+ の API の Bearer パラメータとして使用できない理由を知っている人はいますか?