title: Accessing Picasa Web API using PHP
body: <p>Does anyone here know about how to access Google Photos API now that Google has started using OAuth2? The PHP client library in their developer website is now obsolete and does not work!</p>
  
  <p>I have used OAuth to work with Google Drive but Photos does not work! :(</p>
  
  <p>First I use <code>Google_Client</code> to successfully authenticate user. Then in the redirect page I am trying following:</p>
  
  <pre><code>require_once("Google/Client.php");
  
  //set up path for Zend GData, because Google Documentation uses that lib
  $clientLibraryPath = '/path/to/ZendGData/library';
  $oldPath = set_include_path(get_include_path() . PATH_SEPARATOR . $clientLibraryPath);
  
  require_once 'Zend/Loader.php';
  Zend_Loader::loadClass('Zend_Gdata_Photos');
  
  try
  {
      $authCode = $_GET['code']; //authorization code returned from google
  
      //next create google OAuth Client object and validate...
      $webAuth= new Google_Client();
      $webAuth-&gt;setClientId($clientId);
      $webAuth-&gt;setClientSecret($clientSecret);
      $webAuth-&gt;authenticate($authCode); //this authenticate() works fine...
  
      //now my problem is HOW do I tie this to GData API for Picasa :(
      //I tried following but it throws error 
      //*Token invalid - Invalid token: Request token used when not allowed.*
  
      $client = Zend_Gdata_AuthSub::getHttpClient($authCode);     
      $gp = new Zend_Gdata_Photos($client, "GData:2.0");
      $userFeed = $gp-&gt;getUserFeed("default");
  </code></pre>
  
  <p>I have also tried a bunch of third party libraries, tried hooking up my <code>$webAuth</code> into <code>Zend_GData_Photos</code> in everywhich way I can try...I even tried raw curl calls, but nothing is working!</p>
  
  <p>Can anyone help me please? I am at my wits end....I can't believe Google left a fully functional library (PicasaWeb PHP API Ver 1.0) hanging like that when they updated their authentication to OAuth.</p>