setApplicationName('Gaufrette'); $key = file_get_contents($key_file_location); $cred = new \Google_Auth_AssertionCredentials( $service_account_name, array(\Google_Service_Storage::DEVSTORAGE_FULL_CONTROL), $key ); $client->setAssertionCredentials($cred); if ($client->getAuth()->isAccessTokenExpired()) { $client->getAuth()->refreshTokenWithAssertion($cred); } $service = new \Google_Service_Storage($client); return new Gaufrette\Adapter\GoogleCloudStorage($service, $bucket_name, array(), true);