403 permission denied for google drive api PHP -
i'm having trouble authenticating both calendar api , google drive api. had calendar api working, , wanted add google drive attachment functionality it, can't work. it's giving me error error occurred: error calling https://www.googleapis.com/drive/v2/files: (403) insufficient permission
here code:
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 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);
i have no idea why calendar works , google drive doesn't, , i'm pretty sure authentication in client_secret_path works google drive.
fixed.. authenticated google service before without google drive api scope , apparently authentication doesn't overwrite.
Comments
Post a Comment