i have problem with google drive
first of all I created an account on admin.google.com
there I got the credentials for service account and implemented them in my php application,
is enabled Drive API and Drive SDK it works fine with upload and getting the files from drive.
but when i wont to download it writes 403
- That’s an error.
We're sorry, but you do not have access to this page. That’s all we know.
I tried to download int 2 methods:
-
$downloadUrl = $file->getWebContentLink();
- error 403
Second:
if ($downloadUrl) {
$request = new Google_Http_Request($downloadUrl, 'GET', null, null);
$httpRequest = $service->getClient()->getAuth()->authenticatedRequest($request);
//return Redirect::to( $downloadUrl);
if ($httpRequest->getResponseHttpCode() == 200) {
return $httpRequest->getResponseBody();
} else {
// An error occurred.
return null;
}
} else {
// The file doesn't have any content stored on Drive.
return null;
}
- returns content of the file but wont download
if i access direct download link - its blank page
then i red in the internet that i need to delegate rights for my client id and i did it manage api clients
but the problem didn't disappear.