googleworkspace / php-samples

PHP samples for Google Workspace APIs
Apache License 2.0
288 stars 347 forks source link

credentials.json fatal error #88

Open halburgiss opened 2 years ago

halburgiss commented 2 years ago

Expected Behavior

No error. I don't see anything about credentials.json .... what is it, where does it go, etc.

Actual Behavior

$ php quickstart.php 

PHP Fatal error:  Uncaught InvalidArgumentException: file "credentials.json" does not exist in /home/hal/public_html/google_cloud/apiclient/vendor/google/apiclient/src/Client.php:980
Stack trace:
#0 /home/hal/public_html/google_cloud/apiclient/quickstart.php(33): Google\Client->setAuthConfig()
#1 /home/hal/public_html/google_cloud/apiclient/quickstart.php(79): getClient()
#2 {main}
  thrown in /home/hal/public_html/google_cloud/apiclient/vendor/google/apiclient/src/Client.php on line 980

Steps to Reproduce the Problem

  1. Copy/paste sample code to quickstart.php
  2. run as php quickstart.php

Specifications

bookchiq commented 2 years ago

It is not at all clear from the instructions or the prerequisites themselves, but there's a section at the bottom for Troubleshooting, and in that, an explanation of the actual prerequisites (that result in you having a valid credentials.json file).