Google API: 404 Domain not found
for me was the same error, but i needed to share my calendar with service account email (that found in json auth file). After that, error dissapeared.
Okay, this was a very easy step to overlook but it was an extremely simple fix.
The issue here was that the domain for the account was not identified. I was under the impression that the service account was already attached to the domain but that is not the case. So the fix is just one line of code to add to the client to set it to a user that is in the domain (for my case).
The fix for me was to add:
$client->setSubject('[email protected]');
to my getClient
method.
so now the method looks like:
/**
* Returns an authorized API client.
* @return Google_Client the authorized client object
*/
function getClient() {
$client = new Google_Client();
$client->setApplicationName('TestingApp');
$client->setAuthConfig(CREDENTIALS_PATH);
$client->setScopes(SCOPES);
$client->setSubject('[email protected]');
return $client;
}
I saw this mentioned in the API but it states it as optional. Hopefully this will help someone else too.