$client = new Google_Client(); $client->setApplicationName('My App'); $client->setClientId('my_client_id'); $client->setClientSecret('my_client_secret'); $client->setRedirectUri('https://example.com/oauth2callback'); $client->addScope('https://www.googleapis.com/auth/drive');
$client = new Google_Client(); $client->setAuthConfig('client_secret.json'); $client->addScope([ Google_Service_Drive::DRIVE, Google_Service_Drive::DRIVE_FILE, Google_Service_Drive::DRIVE_METADATA, ]);In this example, we create a new instance of Google_Client and set the client configuration using a JSON file. We then add multiple scopes for the Google Drive API using constants from the Google_Service_Drive class. Package/library: google/apiclient-php