i am trying to build a CMS which uses a Google Drive Account as storage and display its content, files/folders and the user shall be able to manage those files via my Angular FrontEnd. I am new to the google-api and thought i give it a try but i'm stuck.
I am using this library to get it working in PHP on my local xampp.
I try to get a response in a .php test file of the users files like this:
/*************************************************
* Ensure you've downloaded your oauth credentials
************************************************/
if (!$oauth_credentials = getOAuthCredentialsFile())
{
echo missingOAuth2CredentialsWarning();
return;
}
/************************************************
* The redirect URI is to the current page, e.g:
* http://localhost:8080/simple-file-upload.php
************************************************/
$redirect_uri = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
$client = new Google_Client();
$client->setAuthConfig($oauth_credentials);
$client->setRedirectUri($redirect_uri);
$client->addScope(Google_Service_Drive::DRIVE);
$service = new Google_Service_Drive($client);
$pageToken = null;
do {
$response = $service->files->listFiles();
foreach ($response->files as $file) {
printf("Found file: %s (%s)\n", $file->name, $file->id);
}
} while ($pageToken != null);
But this throws Fatal error: Uncaught Google_Service_Exception: { "error": { "errors": [ { "domain": "usageLimits", "reason": "dailyLimitExceededUnreg", "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.",
I got the examples of the git repository to work. But i didn't find a useful example to just query the users file structure.