是否可以邀请域外的用户?

时间:2021-01-03 20:04:00

标签: calendar google-calendar-api

我正在构建一个网络应用,基本上,一个用户可以付费在 Google Meet 中与另一个用户会面。然后,这将创建一个 Google Meet 日历活动,邀请两位用户 + 一位公司用户参加视频会议。

基本上,域是example.com。此电子邮件地址(服务帐户),必须邀请参加者1@companyX.com 和参加者2@companyY.com。当我在没有参加者的情况下举办活动时,没有问题。只要我把其他与会者放在一起,我就会得到:

{ "error": { "errors": [ { "domain": "calendar", "reason": "forbiddenForServiceAccounts", "message": "Service accounts cannot invite attendees without Domain-Wide Delegation of Authority." } ], "code": 403, "message": "Service accounts cannot invite attendees without Domain-Wide Delegation of Authority." } }

我想使用服务帐户,因为它是公司 (example.com),它永远不会改变,而且我不希望网站在密码/任何更改时被破坏。

这是我的代码:

        $client = new Google\Client();
        $client->useApplicationDefaultCredentials();
        $client->addScope(Google_Service_Calendar::CALENDAR);
        $service = new Google_Service_Calendar($client);
        $event = new Google_Service_Calendar_Event(array(
            'summary' => 'Entretien vidéo',
            'start' => array(
              'dateTime' => '2015-05-28T09:00:00-07:00',
              'timeZone' => 'America/Los_Angeles',
            ),
            'end' => array(
              'dateTime' => '2015-05-28T17:00:00-07:00',
              'timeZone' => 'America/Los_Angeles',
            ),
            'recurrence' => array(
              'RRULE:FREQ=DAILY;COUNT=2'
            ),
            'attendees' => [
              [
                'email' => "attendee@email.com"
              ]
            ],
            "conferenceData"=> [
              "createRequest" => [
                "conferenceSolutionKey"=> [
                  "type"=> "hangoutsMeet"
                ],
                "requestId"=> "7qxalsvy0exxaje"
              ]
            ],
          ));

          $calendarId = 'primary';
          $event = $service->events->insert($calendarId, $event);
          printf('Event created: %s\n', $event->htmlLink);    });

有人可以帮我解决这个问题吗?

谢谢!

1 个答案:

答案 0 :(得分:0)

要在您的域中使用 Google 日历,您需要 sign up 的 Gsuite

https://support.google.com/a/answer/39410?hl=en

价格计划:https://support.google.com/a/answer/1247360?hl=en