I'm an Google Admin of my own organization. Google API keys and API access all setup and ready to go. My goal is to manage Gmail accounts without OAuth auth, so I'm forced to use the Google Service Account. To get all users - as an example - I had to create a workaround.
To reproduce:
create a service account in your Google App Console
give the proper scopes in your Google Admin security (advanced) settings
have this composer plugin installed in L5 as found in the readme
Route::get('no-users', function()
{
$service = Google::make('directory'); // according to readme
$results = $service->users->listUsers(); // call to get a list of users
dump($results); // Google_Service_Exception 400 Bad Request
});
I'm an Google Admin of my own organization. Google API keys and API access all setup and ready to go. My goal is to manage Gmail accounts without OAuth auth, so I'm forced to use the Google Service Account. To get all users - as an example - I had to create a workaround.
To reproduce:
Change the scopes in your config/google.php file:
Add these values in your .env file:
Now try to gain access to your users:
To get it working, I ended up using this...
Isn't there a better way to handle this?