google-plusgoogle-app-maker

Cannot run PlusDomains example in Google App Maker


I am trying to run this example code in Google App Maker:

/**
 * The following example demonstrates how to create a post that is available
 * to all users within your G Suite domain.
 */
function createPost() {
  var userId = 'me';
  var post = {
    object: {
      originalContent: 'Happy Monday! #caseofthemondays'
    },
    access: {
      items: [{
        type: 'domain'
      }],
      domainRestricted: true
    }
  };

  post = PlusDomains.Activities.insert(post, userId);
  Logger.log('Post created with URL: %s', post.url);
}

However, I keep getting this:

GoogleJsonResponseException: Access to the Google+ Domains API is not allowed as the user has consented to incompatible scopes. 

Has anybody else managed to get this working?


Solution

  • Pavel's link had the answer: I just had to remove all access at https://security.google.com/settings/security/permissions and then re-authorize.

    Thanks, Pavel!