1

I am using the Google+ Api to create new circles for users. When I try and to a POST request I get a response like this:

 {
  "error": {
    "errors": [
      {
        "domain": "global",
        "reason": "forbidden",
        "message": "Forbidden"
      }
    ],
    "code": 403,
    "message": "Forbidden"
  }
}

This is the same response I get when I try to do the same request using Googles own Google API explorer https://developers.google.com/+/domains/api/circles/insert which seems wierd to me. Why am I getting a forbidden response from googles own api expolrer? Could this be something wrong on their end?

I am using scribe OAuth library together with yincrash Google2Api https://github.com/fernandezpablo85/scribe-java

https://gist.github.com/yincrash/2465453

The request is created like this in an AsyncTask

OAuthService service = new ServiceBuilder()
                .provider(Google2API.class)
                .apiKey(GOOGLE_CLIENT_ID)
                .apiSecret(GOOGLE_CLIENT_KEY)
                .callback(GOOGLE_CALLBACK)
                .scope(SCOPE_WRITE)
                .scope(SCOPE_ME)
                .build();

        String postUrl = "https://www.googleapis.com/plusDomains/v1/people/me/circles";


        String requestBody = "{\n" +
                "  \"displayName\": \"Circle Name\",\n" +
                "  \"description\": \"Circle with people you added\"" +
                "}";

        Token accessToken = new Token(sharedPreferences.getString(PREF_GOOGLE_KEY, ""), "");
        OAuthRequest request = new OAuthRequest(Verb.POST, postUrl);
        request.addHeader("Content-Type", "application/json")
        request.addPayload(requestBody);
        service.signRequest(accessToken, request);
        Response response = request.send();

It works fine to login and I have the access token saved.

Danjoa
  • 143
  • 4
  • 14
  • Are you performing this action as an user@gmail.com Google account or an user@example.com Google Apps for Business account? – abraham Aug 07 '15 at 18:48
  • I am trying to perfom this as a gmail user with a @gmail.com address. – Danjoa Aug 07 '15 at 18:59
  • possible duplicate of [Issue while fetching Google+ Circle information using Google+ Domain API](http://stackoverflow.com/questions/21474875/issue-while-fetching-google-circle-information-using-google-domain-api) – abraham Aug 07 '15 at 21:15
  • The Domains API does not work with user@gmail.com accounts. – abraham Aug 07 '15 at 21:16
  • @abraham Well is there an answer how to solve this with gmail accounts? Or is it not possible to create a circle on google plus for users who have a gmail account? It sounds really wierd to me. – Danjoa Aug 07 '15 at 23:14
  • You can't, the standard Google+ API is read only. – abraham Aug 07 '15 at 23:23

0 Answers0