Php Google API日历403权限不足错误
早些时候,我发送了一些请求来获取日历列表,结果一切正常。但是,当我想用另一个作用域(Google_Service_calendar::calendar)创建辅助日历时,它会处理这个403 insufficientPermission错误 这是密码Php Google API日历403权限不足错误,php,xampp,google-calendar-api,Php,Xampp,Google Calendar Api,早些时候,我发送了一些请求来获取日历列表,结果一切正常。但是,当我想用另一个作用域(Google_Service_calendar::calendar)创建辅助日历时,它会处理这个403 insufficientPermission错误 这是密码 <?php require_once 'vendor/autoload.php'; session_start(); $client = new Google_Client(); $client->setAuthC
<?php
require_once 'vendor/autoload.php';
session_start();
$client = new Google_Client();
$client->setAuthConfig('client-secret.json');
$client->addScope(Google_Service_Calendar::CALENDAR);
if (isset($_SESSION['access_token']) && $_SESSION['access_token']) {
$client->setAccessToken($_SESSION['access_token']);
$service= new Google_Service_Calendar($client);
$calendar = new Google_Service_Calendar_Calendar();
$calendar->setSummary('CalendarioProper');
$calendar->setTimeZone('Europe/Madrid');
$createdCalendar = $service->calendars->insert($calendar);
echo $createdCalendar->getId();
} else {
$redirect_uri = 'http://' . $_SERVER['HTTP_HOST'] .'/oauth2callback.php';
header('Location: ' . filter_var($redirect_uri, FILTER_SANITIZE_URL));
}
?>
我正在用XAMPP通过本地主机做所有事情,也许这与我的问题有关?谢谢,我的英语不是最好的抱歉。谢谢,我的英语不是最好的抱歉。
Uncaught Google_Service_Exception: {
"error":
{ "errors": [ {
"domain": "global",
"reason": "insufficientPermissions",
"message": "Insufficient Permission" } ],
"code": 403,
"message": "Insufficient Permission" } }