title: Google_Client()->authenticate($code) error invalid_grant php
body: <p>First Excuse me my English, is very bad...
  My question is: what should be the parameter of method ''authenticate($code)" of class  Google_Client???
  I have written Email address to Client ID for web applications;  next I have written client ID to , and always  return error 'invalid_grant'</p>
  
  <p>This is the error </p>
  
  <pre><code>[Tue Apr 22 10:22:19 2014] [error] [client 127.0.0.1] PHP Fatal error:  Uncaught exception 'Google_Auth_Exception' with message 'Error fetching OAuth2 access token, message: 'invalid_grant'' in /var/www/Repartos/Google/Auth/OAuth2.php:124\nStack trace:\n#0 /var/www/Repartos/Google/Client.php(136): Google_Auth_OAuth2-&gt;authenticate('499123288166@de...')\n#1 /var/www/Repartos/index.php(36): Google_Client-&gt;authenticate('499123288166@de...')\n#2 {main}\n  thrown in /var/www/Repartos/Google/Auth/OAuth2.php on line 124
  </code></pre>
  
  <p>This is my code</p>
  
  <pre><code>&lt;?php
  // put your code here
  
  //Incluimos la ubicación de las librerías para poder utilizarlo en nuestra app
  session_start();
  require_once 'Google/Client.php';
  require_once 'Google/Service.php';
  require_once 'Google/Service/Tasks.php';
  // Creamos el objeto de la API de Google, primero un objeto de la clase Client
  $cliente = new Google_Client();
  $idCliente ='xxxxxx';
  $secertCliente='xxxxx';
  $key='xxxxx';
  // Y lo configuramos con los nuestros identificadores
  $cliente-&gt;setApplicationName("Gestor de repartos");
  $cliente-&gt;setClientId('$IdCliente');
  $cliente-&gt;setClientSecret('·$secertClient');  
  $cliente-&gt;setRedirectUri('http://localhost/Repartos/index.php');
  $cliente-&gt;setDeveloperKey('$key');
  $cliente-&gt;setScopes(array('https://www.googleapis.com/auth/tasks'));
  $apitareas = new Google_Service_Tasks($cliente);
  
  //Ahora nos autentificamos
  
  if (isset($_SESSION['clave_acceso'])) {
     $cliente-&gt;setAccessToken($_SESSION['clave_acceso']);
  } else {
   //Petada total al utentificarse
  $cliente-&gt;setAccessToken($cliente-&gt;authenticate('$code'));
  $_SESSION['clave_acceso'] = $cliente-&gt;getAccessToken();
  }
  </code></pre>
  
  <p>Thaks!!!!!!!</p>