I have a slight problem, and I'm not sure if i'm missing something here. I am building a website where the user logs in and authorizes google etc and keeps the refresh token in the db (which works fine)
I also get the userinfo (which also works fine).
But whenever I try to get the list of files the user has, the items return 0. I am using this code:
if ($client->getAccessToken()) {
$drive = new apiDriveService($client);
$result = $drive->files->listFiles();
$countArray = count($result['items']) - 1;
foreach($result['items'] as $i=>$row){
$isFirst = ($i == 0);
$isLast = ($i == $countArray);
$sql = "INSERT INTO docs (title, notecontent, folderid, filestatus, linkhref, useremail)
VALUES (".$row['title'].",".$row['id'].", 2, 1,".$row['alternateLink'].", ".$usernamei.")";
$db->query($sql, true);
}
}
Basically what I'm trying to do is get a list of files the user has and save them in a database.
Any help would be appreciated :)
Thanks !
Removing $client->accessType and $client->useObjects seemed to do the job ... :)