13

I have a google site with a form.I have added a script to the form's spreadsheet and added a "on form submit" trigger. I am trying to create an empty circle.

Here is the script.

function createCircle(e) {

try{
  var email  = Session.getActiveUser().getEmail();
  var sh = SpreadsheetApp.getActiveSheet();
  var circle = PlusDomains.newCircle();
  circle.displayName = e.values[1];
  var userId = 'me';
  circle = PlusDomains.Circles.insert(circle, userId);
  MailApp.sendEmail(email,'event created' , "Circle name is ");
  }catch(e){
    var email  = Session.getActiveUser().getEmail();
    MailApp.sendEmail(email,'event failed' , e.message);
  }

}

I have activated the Google+ Domains API for the script by going to Resources->Advanced Google Services. There is a line that says These services must also be enabled in the Google Developers Console. So I went into the Developers console and activated the API.

I still get the same error, Access Not Configured. Please use Google Developers Console to activate the API for your project.

nupac
  • 2,459
  • 7
  • 31
  • 56
  • 1
    Did you also activate the Google+ API and Drive API in the developers console? – abraham Jan 09 '14 at 13:37
  • I did. I left this yesterday and am back at it today. This error is gone but new error, "Forbidden" – nupac Jan 10 '14 at 02:39
  • That likely means that the credentials you are using are expired or invalid. – abraham Jan 10 '14 at 05:17
  • do you mean the credentials of the user currently logged in? – nupac Jan 10 '14 at 05:19
  • I am getting the same response. Been Googling for HOURS. Did you manage to work this one out? – nickspiel Jan 10 '14 at 12:30
  • @nickspiel still stuck, will post an answer as soon as I get this to work – nupac Jan 11 '14 at 04:11
  • I started a thread with my situation. Some of the discussion on the comments may be of help to you, i am not sure. Still cannot get this to work... http://stackoverflow.com/questions/21056303/google-analytics-php-api-error-403-access-not-configured?noredirect=1#comment31661728_21056303 – nickspiel Jan 11 '14 at 12:04
  • I had a similar problem with the youtube API. After getting this message I switched the big Youtube API switch to ON, but I still continued getting this message. However, roughly 5 minutes later it started working. So it seems there is some delay before the API is activated, which leads to some serious headscratching and "wtf do I do now?" moments. Maybe for others the delay is longer. It would be nice if they mentioned this. – Michael Bylstra Apr 27 '14 at 11:13

2 Answers2

6

It's exactly what it says. To fix:

  1. Goto Google Developers Console on https://console.developers.google.com
  2. Choose your project from the list
  3. Select API's from the left nav
  4. Turn ON the API you are trying to access.

You may need to regenerate your access and refresh token for this to work.

Gaurav Gupta
  • 5,380
  • 2
  • 29
  • 36
0

You are using PlusDomains.Circles.insert. Make sure your site is created under your paid Google Apps account, PlusDomains will only work with Google Domains (i.e. paid accounts). Just a thought

momo
  • 3,404
  • 6
  • 37
  • 66
  • 1
    I added billing details to this account yesterday morning. A couple of other posts i have read said that the billing status can take a while to come through. After looking at this again this morning I am getting a new error: 'undefined function getResults' which means it has now passed the credentials check. :) I am pretty annoyed that Google force you to add billing to your account even for testing their service. Not cool. – nickspiel Jan 12 '14 at 21:26
  • I didn't even try this API, but I am pretty sure you can test the Plus API with a free account. The thing here is that you guys are using the Plus API for Domains, there should be the free version as well (I never use it, so I am not sure, but it looks like free accounts should be using the GPlusApp library instead) – momo Jan 13 '14 at 04:27