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