使用Spatial/laravel谷歌日历模拟用户

使用Spatial/laravel谷歌日历模拟用户,laravel,google-calendar-api,spatie,Laravel,Google Calendar Api,Spatie,所以我想在谷歌日历上创建的活动上向与会者发送邀请电子邮件。但当我这么做的时候 use Spatie\GoogleCalendar\Event as GoogleCalendarEvent; $calendarEvent = new GoogleCalendarEvent; $calendarEvent->name = $event->title; $calendarEvent->startDateTime = $event->start_date; $calendar

所以我想在谷歌日历上创建的活动上向与会者发送邀请电子邮件。但当我这么做的时候

use Spatie\GoogleCalendar\Event as GoogleCalendarEvent;

$calendarEvent = new GoogleCalendarEvent;

$calendarEvent->name = $event->title;
$calendarEvent->startDateTime = $event->start_date;
$calendarEvent->endDateTime = $event->end_date;
$calendarEvent->addAttendee(['email' => 'isley269@gmail.com']);

$calendarEvent->save();
我得到的错误是

{ "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." 
    } 
}
所以我已经给了服务凭证一个域范围的权限。但我仍然收到错误,因为我试图使用服务帐户邀请用户。如何使用Spatial\GoogleCalendar在laravel 7中模拟使用此服务帐户的用户

我试着浏览谷歌的api和Spatiale的文档。但是我找不到任何

这个问题已经在谷歌的 目前,不允许服务帐户在没有模拟的情况下邀请与会者

为了实现模拟,您需要添加行

$client->setSubject('在此处指定要模拟的用户')

使用服务帐户创建新的Google_客户端()时


有关更多信息,请参阅。

我也有同样的问题,需要在哪里添加setSubject?使用Spatial/laravel google calendar无需新建google_客户端()我已经修改了使用Spatial/laravel google calendar的google calendar工厂,添加$Client->setSubject(“用户邮件”);在新的Google_客户端()之后。返回的错误为“{”error:“unauthorized_client”,“error_description:“client无权使用此方法检索访问令牌,或者client未被授权用于请求的任何作用域。”}