0
我無法驗證日曆API和谷歌驅動器API。我有日曆API工作,我想添加谷歌驅動器附件功能,但不能讓它工作。它給我這個錯誤 時出現錯誤:錯誤調用get https://www.googleapis.com/drive/v2/files:(403)沒有足夠的權限403權限拒絕谷歌驅動器API PHP
這裏是我的代碼:
define('CLIENT_SECRET_PATH', __DIR__ . '/client_secret.json');
$client->setAuthConfigFile(CLIENT_SECRET_PATH);
$client->addScope("https://www.googleapis.com/auth/drive");
$client->addScope("https://www.googleapis.com/auth/calendar");
$googleService = new Google_Service_Calendar($client);
$drive_service = new Google_Service_Drive($client);*/
define('SCOPES', implode(' ', array(
Google_Service_Drive::DRIVE_METADATA_READONLY)
));
// Setup the Google Calendar class
$googleClient = new Google_Client();
$googleClient->setApplicationName('test');
$googleClient->setScopes(SCOPES);
$googleClient->addScope("https://www.googleapis.com/auth/drive");
$googleClient->addScope("https://www.googleapis.com/auth/Calendar");
$googleClient->setAuthConfigFile(CLIENT_SECRET_PATH);
$googleService = new Google_Service_Calendar($googleClient);
$driveService = new Google_Service_Drive($googleClient);
我不知道爲什麼日曆作品和谷歌驅動器不,並且我很確定CLIENT_SECRET_PATH中的身份驗證適用於谷歌驅動器。