Google Calendar API v3 - Not Creating Event (Server-to-Server Authentication)

后端 未结 1 674
一个人的身影
一个人的身影 2020-12-10 09:28

So after digging around for several hours, I\'m at a loss for a solution. I\'m attempting to create an event on my primary calendar using v3 of Google\'s Calendar API, but I

相关标签:
1条回答
  • 2020-12-10 10:27

    It's creating the event in the calendar owned by the service account, if you want to manage it, you have to share the calendar with yourself (!):

    $scope = new Google_AclRuleScope();
    $scope->setType('user');
    $scope->setValue('YOUR-EMAIL-HERE');
    
    $rule = new Google_AclRule();
    $rule->setRole('owner');
    $rule->setScope($scope);
    
    $result = $service->acl->insert('primary', $rule);
    

    Reference: Who owns calendars created by service account via Google Calendar API and how can they be shared?

    PS: there's a new version of the PHP client library.

    0 讨论(0)
提交回复
热议问题