Tôi cố gắng để cập nhật google sự kiện lịch nhưng nó không phải đang làm việc với lịch mặc định .. tôi có nghĩa là khi tôi sử dụng lịch mặc định 'chính' nó không được làm việc đây là mã của tôiLỗi khi cập nhật google sự kiện
const USER_EVENT_TYPE='primary';
const CLASS_EVENTS='Events';
if ($googleClient->getAccessToken())
{
if(!class_exists(self::CLASS_EVENTS))
{
$includeApplicationFiles=Mage::getBaseDir(self::LIBRARY_PATH);
foreach (glob($includeApplicationFiles.self::INCLUDE_ALL_FILES) as $retrieveFiles)
{
include $retrieveFiles;
}
$allCalendarEvents = $googleCalendar->events->listEvents(self::USER_EVENT_TYPE);
foreach ($allCalendarEvents->getItems() as $getSingleEvent) {
if($selectedEventValue==$getSingleEvent->summary)
{
$getSingleEvent->setSummary($selectedEventValue);
$addEventGuests = new Google_EventAttendee();
$addEventGuests->setEmail($selectGuestValue);
$invitedGuests = array($addEventGuests);
$getSingleEvent->attendees = $invitedGuests;
$updatedEvent = $googleCalendar->events->update(self::USER_EVENT_TYPE, $getSingleEvent->getId(),$getSingleEvent);
}
}
}
}
có lỗi như thế này
<br />
<b>Fatal error</b>: Uncaught exception 'Google_ServiceException' with message 'Error calling PUT https://www.googleapis.com/calendar/v3/calendars/primary/events/5vmet3i6mmak81utnj2p0ebv8g?key=900220817963%40developer.gserviceaccount.com: (403) Forbidden' in C:\xampp\htdocs\magento\lib\google-api-php-client\src\io\Google_REST.php:61
Stack trace:
#0 C:\xampp\htdocs\magento\lib\google-api-php-client\src\io\Google_REST.php(35): Google_REST::decodeHttpResponse(Object(Google_HttpRequest))
#1 C:\xampp\htdocs\magento\lib\google-api-php-client\src\service\Google_ServiceResource.php(152): Google_REST::execute(Object(Google_HttpRequest))
#2 C:\xampp\htdocs\magento\lib\google-api-php-client\src\contrib\Google_CalendarService.php(591): Google_ServiceResource->__call('update', Array)
#3 C:\xampp\htdocs\magento\app\code\local\Social\Google\Model\Google.php(360): Google_EventsServiceResource->update('primary', '5vmet3i6mmak81u...', Object(Google_Event))
#4 C:\xampp\htdocs\magento\Connectors\google\AutoCompleteCalendarEvents.php(16): Social_Goog in <b>C:\xampp\htdocs\magento\lib\google-api-php-client\src\io\Google_REST.php</b> on line <b>61</b><br />
(403) Cấm: Đã xảy ra sự cố với xác thực của bạn, bạn không có quyền truy cập nếu bạn thấy điều đó. – DaImTo