title: Get user birthday with Google API
body: <p>I am using the Google API to help users login to my website. I can extract their name, locale, profile picture, gender and ID during the login with the API but I can't get their birthday. </p>
  
  <p>How would I go about getting their birthday with the API?</p>
  
  <p>The code:</p>
  
  <pre><code>session_start();
  $google_client_id       = 'xx';
  $google_client_secret   = 'xx';
  $google_redirect_url    = 'xx'; 
  $google_developer_key   = 'xx';
  
  require_once 'Google_Client.php';
  require_once 'contrib/Google_Oauth2Service.php';
  
  $gClient = new Google_Client();
  $gClient-&gt;setApplicationName('xx');
  $gClient-&gt;setClientId($google_client_id);
  $gClient-&gt;setClientSecret($google_client_secret);
  $gClient-&gt;setRedirectUri($google_redirect_url);
  $gClient-&gt;setDeveloperKey($google_developer_key);
  $gClient-&gt;setScopes(array('email', 'https://www.googleapis.com/auth/plus.login'));
  $google_oauthV2 = new Google_Oauth2Service($gClient);
  if (isset($_GET['code'])) 
  { 
      $gClient-&gt;authenticate($_GET['code']);
      $_SESSION['token'] = $gClient-&gt;getAccessToken();
  }
  
  if (isset($_SESSION['token'])) 
  { 
      $gClient-&gt;setAccessToken($_SESSION['token']);
  }
  if ($gClient-&gt;getAccessToken()) 
  {   
        $user                          = $google_oauthV2-&gt;userinfo-&gt;get();
        $user_google_id                = $user['id'];
        $user_name                     = filter_var($user['name'], FILTER_SANITIZE_SPECIAL_CHARS);
        $user_first_name           = filter_var($user['given_name'], FILTER_SANITIZE_SPECIAL_CHARS);
        $user_last_name                = filter_var($user['family_name'], FILTER_SANITIZE_SPECIAL_CHARS);
        $user_gender               = filter_var($user['gender'], FILTER_SANITIZE_SPECIAL_CHARS);
        $user_country                  = filter_var($user['locale'], FILTER_SANITIZE_SPECIAL_CHARS);
        $user_age                  = filter_var($user['birthday'], FILTER_SANITIZE_SPECIAL_CHARS);
        $user_email                    = filter_var($user['email'], FILTER_SANITIZE_EMAIL);
        $profile_url               = filter_var($user['link'], FILTER_VALIDATE_URL);
        $profile_image_url             = filter_var($user['picture'], FILTER_VALIDATE_URL);
        $user_image                    = "$profile_image_url?sz=150";
        $_SESSION['token']             = $gClient-&gt;getAccessToken();  
  }
  </code></pre>