Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle Plus DomainsAPI wide-domain autorization
    primarykey
    data
    text
    <p>Good morning I'm trying to integrate the <code>Google+ Domains</code> API with my company domain but I'm facing some problems.</p> <p>I'm trying the java approach following the quick start for java but after implement the code the response from the google server is :</p> <pre><code>Authenticate the domain for hugo.catarino@outsystems.com Inserting activity 10/Set/2013 17:08:49 com.google.api.client.googleapis.services.AbstractGoogleClient &lt;init&gt; WARNING: Application name is not set. Call Builder#setApplicationName. Exception in thread "main" com.google.api.client.auth.oauth2.TokenResponseException:400 Bad Request { "error" : "access_denied" } at com.google.api.client.auth.oauth2.TokenResponseException.from(TokenResponseException.java:105) at com.google.api.client.auth.oauth2.TokenRequest.executeUnparsed(TokenRequest.java:287) at com.google.api.client.auth.oauth2.TokenRequest.execute(TokenRequest.java:307) at com.google.api.client.googleapis.auth.oauth2.GoogleCredential.executeRefreshToken(GoogleCredential.java:269) at com.google.api.client.auth.oauth2.Credential.refreshToken(Credential.java:489) at com.google.api.client.auth.oauth2.Credential.intercept(Credential.java:217) at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:858) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:410) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460) at com.google.plus.samples.quickstart.domains.DomainDelegation.main(DomainDelegation.java:160) </code></pre> <p>here is used authentication method and my variables:</p> <pre><code>private static final String SERVICE_ACCOUNT_EMAIL = "638852846577@developer.gserviceaccount.com"; private static final String SERVICE_ACCOUNT_PKCS12_FILE_PATH = "src/com/google/plus/samples/quickstart/domains/05cab8e819cbd0a747b180c1f22fc93dba916b7b-privatekey.p12"; private static final String USER_EMAIL = "hugo.catarino@outsystems.com"; private static Plus authenticate() throws GeneralSecurityException, IOException { System.out.println(String.format("Authenticate the domain for %s", USER_EMAIL)); HttpTransport httpTransport = new NetHttpTransport(); JsonFactory jsonFactory = new JacksonFactory(); // Setting the sub field with USER_EMAIL allows you to make API calls using the special keyword // 'me' in place of a user id for that user. GoogleCredential credential = new GoogleCredential.Builder() .setTransport(httpTransport) .setJsonFactory(jsonFactory) .setServiceAccountId(SERVICE_ACCOUNT_EMAIL) .setServiceAccountScopes(SCOPE) .setServiceAccountUser(USER_EMAIL) .setServiceAccountPrivateKeyFromP12File( new java.io.File(SERVICE_ACCOUNT_PKCS12_FILE_PATH)).build(); // Create and return the Plus service object Plus service = new Plus.Builder(httpTransport, jsonFactory, credential).build(); return service; } </code></pre> <p>My main class has the following code like in the sample:</p> <pre><code>Plus service = authenticate(); String userId = "me"; String msg = "Happy Monday! #caseofthemondays"; System.out.println("Inserting activity"); // Create the audience of the post PlusAclentryResource res = new PlusAclentryResource(); // Share to the domain res.setType("domain"); List&lt;PlusAclentryResource&gt; aclEntries = new ArrayList&lt;PlusAclentryResource&gt;(); aclEntries.add(res); Acl acl = new Acl(); acl.setItems(aclEntries); // Required, this does the domain restriction acl.setDomainRestricted(true); Activity activity = new Activity() .setObject(new Activity.PlusObject().setOriginalContent(msg)) .setAccess(acl); activity = service.activities().insert(userId, activity).execute(); System.out.println(activity); </code></pre> <p>In domain <code>cPanel</code> the company defined for me the next scopes:</p> <pre><code>https://www.googleapis.com/auth/plus.circles.read https://www.googleapis.com/auth/plus.circles.write https://www.googleapis.com/auth/plus.me https://www.googleapis.com/auth/plus.media.upload https://www.googleapis.com/auth/plus.stream.read https://www.googleapis.com/auth/plus.stream.write </code></pre> <p>My scope definition is:</p> <pre><code>private static final List&lt;String&gt; SCOPE = Arrays.asList( "https://www.googleapis.com/auth/plus.circles.read", "https://www.googleapis.com/auth/plus.circles.write", "https://www.googleapis.com/auth/plus.me", "https://www.googleapis.com/auth/plus.media.upload", "https://www.googleapis.com/auth/plus.stream.read", "https://www.googleapis.com/auth/plus.stream.write"); </code></pre> <p>I'm a bit lost here , is there any way of debug this problem or know why is this access denied?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload