1
votes

I'm trying to implement a connection from my laptop to Google API using the method of OAuth 2.0 for Server to Server Applications. I'm working in PHP.

I've declared that account and downloaded the associated JSON file.

I've also read this changelog. The original documentation seems outdated as it uses the P12 strategy.

I've coded :

set_include_path(get_include_path() . PATH_SEPARATOR . '/home/samuel/workspace/DABphp/lib/Google/');
require_once 'autoload.php';
[...]
$client = new Google_Client();
$client->setAuthConfig('private/DABmap-2.json');
$client->useDefaultApplicationCredentials();
$client->addScope('https://www.googleapis.com/auth/fusiontables');
if ($client->getAuth()->isAccessTokenExpired()) {
    $client->getAuth()->refreshTokenWithAssertion();
}

I'm getting this error :

Uncaught exception 'Google_Exception' with message 'Invalid client secret JSON file.' in /home/samuel/workspace/DABphp/lib/Google/Client.php:171 Stack trace: #0 /home/samuel/workspace/DABphp/ajouter-dab.php(80): Google_Client->setAuthConfig('private/DABmap-...') #1 {main}

I've tried to download again a fresh key. I didn't touch the file. That's the same.

1

1 Answers

1
votes

This seems to be a known bug referenced here.