title: Edit Google calendar events from Google service account: 403
body: <p>I want to create new event at google calendar from Service Account.
  I can access correctly and print a list all my calendars. 
  But when I want to create a new event the response is 403 Forbidden.</p>
  
  <p>My code:</p>
  
  <pre><code>require_once 'src/Google_Client.php';
  require_once 'src/contrib/Google_CalendarService.php';
  
  session_start();
  
  const CLIENT_ID = 'XXXXXXXXXX.apps.googleusercontent.com';
  const SERVICE_ACCOUNT_NAME = 'XXXXXXXXXXXX@developer.gserviceaccount.com';
  
  const KEY_FILE = 'google_src/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-privatekey.p12';
  
  $client = new Google_Client();
  $client-&gt;setApplicationName("APP_NAME");
  
  if (isset($_SESSION['token'])) {
   $client-&gt;setAccessToken($_SESSION['token']);
  }
  
  $key = file_get_contents(KEY_FILE);
  $client-&gt;setClientId(CLIENT_ID);
  $client-&gt;setAssertionCredentials(new Google_AssertionCredentials(
    SERVICE_ACCOUNT_NAME,
    'https://www.google.com/calendar/feeds/MY_CALENDAR_ID/private/full/',
    $key)
  );
  
  $client-&gt;setClientId(CLIENT_ID);
  $cal = new Google_CalendarService($client);
  $event = new Google_Event();
  $event-&gt;setSummary('Bon dia pel matí!');
  $event-&gt;setLocation('Somewhere');
  $start = new Google_EventDateTime();
  $start-&gt;setDateTime('2012-08-06T10:00:00.000-07:00');
  $event-&gt;setStart($start);
  $end = new Google_EventDateTime();
  $end-&gt;setDateTime('2012-09-06T10:25:00.000-07:00');
  $event-&gt;setEnd($end);
  
  $createdEvent = $cal-&gt;events-&gt;insert(CALENDAR_NAME, $event);
  </code></pre>
  
  <p>And server response:</p>
  
  <pre><code>(403) Forbidden
  </code></pre>
  
  <p>Any ideas? Maybe other scope, or allow edit events  (I dont know where I can configure this and I have searched it, promise)</p>
  
  <p>Of course, my calendar is a public calendar.</p>
  
  <p>Any help will be welcome :)</p>
  
  <p>Thanks!</p>