Problems using api auth with Google Calendar API

742 views
Skip to first unread message

Evan Siroky

unread,
Oct 2, 2015, 3:30:23 PM10/2/15
to Google API JavaScript Client

I'm working on a small website that can do stuff with the Google Calendar API. I've posted it over here: http://evansiroky.com/temp-gcal-question/tests/ Whenever I try to authorize, it doesn't seem to matter what clientId I use, it always says it is authorized. Also, it doesn't seem to matter if immediate is set to true or false. Here is the authorization code:

gapi.auth.authorize({ 
  client_id: clientId, 
  scope: ['https://www.googleapis.com/auth/calendar'], 
  immediate: immediate
}, function(authResult) {
  if(authResult && !authResult.error) {
    isAuthorized = true;
  } else {
    isAuthorized = false;
  }
  if(callback) {
    var out = isAuthorized ? null : authResult;
    callback(out);
  }
});

However, once I try to list events of a calendar, I get a dailyLimitExceededUnreg error. Here is the code for listing events:

gapi.client.load('calendar', 'v3', function() {
  var request = gapi.client.calendar.events.list(_.extend({
    calendarId: 'primary',
    orderBy: 'starttime',
    singleEvents: true, 
    showDeleted: true,
  }, options.data));

  request.then(function(resp) {
    options.success(resp);
  }, function(reason) {
    options.failure(reason);
  });
});

And here is the error that is returned:

{
  "result": {
    "error": {
      "errors": [
        {
          "domain": "usageLimits",
          "reason": "dailyLimitExceededUnreg",
          "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.",
          "extendedHelp": "https://code.google.com/apis/console"
        }
      ],
      "code": 403,
      "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."
    }
  },
  "body": "{\n \"error\": {\n  \"errors\": [\n   {\n    \"domain\": \"usageLimits\",\n    \"reason\": \"dailyLimitExceededUnreg\",\n    \"message\": \"Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.\",\n    \"extendedHelp\": \"https://code.google.com/apis/console\"\n   }\n  ],\n  \"code\": 403,\n  \"message\": \"Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.\"\n }\n}\n",
  "headers": {
    "date": "Fri, 02 Oct 2015 19:08:41 GMT",
    "content-encoding": "gzip",
    "server": "GSE",
    "vary": "Origin, X-Origin",
    "content-type": "application/json; charset=UTF-8",
    "cache-control": "private, max-age=0",
    "content-length": "215",
    "expires": "Fri, 02 Oct 2015 19:08:41 GMT"
  },
  "status": 403,
  "statusText": "OK"
}

What am I doing wrong?  I've also posted this question to stackoverflow:  http://stackoverflow.com/questions/32914475/problems-using-api-auth-with-google-calendar-js-api

Reply all
Reply to author
Forward
0 new messages