I want to share with you the modifications I've done to use service account (json file) to authenticat instead of using Oauth tokens:
At file app\Providers\GoogleDriveServiceProvider change :
$client = new \Google_Client();
$client->setClientId($config['clientId']);
$client->setClientSecret($config['clientSecret']);
$client->refreshToken($config['refreshToken'])
to
$credentials_file = storage_path('app/gsuite_service_accounts/scool-07eed0b50a6f.json');
$client = new Google_Client();
$client->setAuthConfig($credentials_file);
$client->addScope(Google_Service_Drive::DRIVE);
$client->setSubject('sergitur@iesebre.com');
Also don't forget to add permissions (scope: https://www.googleapis.com/auth/drive) to this client in your Google Suite domain to avoid permission errors enteirng at your Admin console at security section > Advanced >Manage API client access URL similar to:
Hello,
I want to share with you the modifications I've done to use service account (json file) to authenticat instead of using Oauth tokens:
At file app\Providers\GoogleDriveServiceProvider change :
to
Also don't forget to add permissions (scope: https://www.googleapis.com/auth/drive) to this client in your Google Suite domain to avoid permission errors enteirng at your Admin console at security section > Advanced >Manage API client access URL similar to:
https://admin.google.com/YOUR_DOMAIN/AdminHome?chromeless=1#OGX:ManageOauthClients