I have copied the code in their documentation on this site: here.
I have changed the JSON on these below. I have generated a fresh files on API on the composer, but I am still having some issues. I'm not sure what have I done wrong. Does this mean their API is way too buggy?
Here is the demo link: demo
define('APPLICATION_NAME', 'Ashima');
define('CREDENTIALS_PATH', '/mycredentials.json');
define('CLIENT_SECRET_PATH', __DIR__ .'/mysecret.apps.googleusercontent.com.json');
Error:
Fatal error: Uncaught exception 'InvalidArgumentException' with message 'file does not exist' in /var/www/mysite/googleapi2/vendor/google/apiclient/src/Google/Client.php:839 Stack trace: #0 /var/www/mysite/googleapi2/quick.php(32): Google_Client->setAuthConfig('/var/www/payrol...') #1 /var/www/mysite/googleapi2/quick.php(80): getClient() #2 {main} thrown in /var/www/mysite/googleapi2/vendor/google/apiclient/src/Google/Client.php on line 839
Here I'm:
1) "CREDENTIALS_PATH" should point to a nonexistent file (in a writable path)
2) "CLIENT_SECRET_PATH" should point to the "ID client OAuth 2.0" credential file, created and downloaded from the Google Console in the Api Credential section.
For a server side php script, like yours, pay attention when creating the "ID client OAuth 2.0" record: on the creation wizard, you should select "other" type of application and not the "web" type.
Regards
The CLIENT_SECRET_PATH is not the CLIENT ID JSON file.
After creating the OAuth 2.0 client IDs for the project from below link you need to create a service account keys, to do this follow those steps: