PHP code example of revolution / authorize-google-api
1. Go to this page and download the library: Download revolution/authorize-google-api library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
revolution / authorize-google-api example snippets
$credentials = [
'application_name' => '',
'client_id' => '',
'client_secret' => '',
'redirect_uri' => '',
'scopes' => [\Google_Service_PhotosLibrary::PHOTOSLIBRARY],
'access_type' => 'online',
'approval_prompt' => 'auto',
'prompt' => 'consent',
];
if (Authorize::driver('google-api')->login($credentials)) {
/**
* @var \Google_Client $client
*/
$client = Authorize::driver('google-api')->client();
$client->setAccessToken($token);
$photos = new \Google_Service_PhotosLibrary($client);
}