title: error with authen in google-api-php
body: <p>I'm trying to run this script:</p>
  
  <pre><code>require_once('autoload.php');
  require_once('Client.php');
  
  $client = new Google_Client();
  
          $client-&gt;setClientId('my clientid');
          $client-&gt;setClientSecret('my secret');
          $client-&gt;setDeveloperKey('my developer key');
          $client-&gt;setApprovalPrompt('auto');
          $client-&gt;setAccessType('offline');
          $client-&gt;setRedirectUri(null);
          $client-&gt;setScopes(array('https://www.googleapis.com/auth/userinfo.profile','https://www.googleapis.com/auth/analytics'));
  
  
  
  $service    =   new Google_Service_Analytics($client);
  
  // get accounts from analytics
  $accounts   = $service-&gt;management_accounts-&gt;listManagementAccounts();
  </code></pre>
  
  <p>But then, it's giving me this error:</p>
  
  <blockquote>
    <p>PHP Fatal error:  Uncaught exception 'Google_Service_Exception' with
    message
    '{"error":{"errors":[{"domain":"global","reason":"required","message":"Login
    Required","locationType":"header","location":"Authorization"}],"code":401,"message":"Login
    Required"}}' in
    /root/google-api/google-api-php-client-2.0.0-RC5/src/Google/Http/REST.php:129
    Stack trace:<br>
    #0 /root/google-api/google-api-php-client-2.0.0-RC5/src/Google/Http/REST.php(88):
    Google_Http_REST::decodeHttpResponse(Object(GuzzleHttp\Psr7\Response),
    Object(GuzzleHttp\Psr7\Request), 'Google_Service_...')
    #1 [internal function]: Google_Http_REST::doExecute(Object(GuzzleHttp\Client),
    Object(GuzzleHttp\Psr7\Request), 'Google_Service_...')
    #2 /root/google-api/google-api-php-client-2.0.0-RC5/src/Google/Task/Runner.php(181):
    call_user_func_array(Array, Array)
    #3 /root/google-api/google-api-php-client-2.0.0-RC5/src/Google/Http/REST.php(57):
    Google_Task_Runner->run()
    #4 /root/google-api/google-api-php-client-2.0.0-RC5/src/Google/Client.php(758):
    Google_Http_REST::execute(Object(GuzzleH in
    /root/google-api/google-api-php-client-2.0.0-RC5/src/Google/Http/REST.php
    on line 129</p>
  </blockquote>
  
  <p>Why?</p>