0
votes

I am working on Google cloud platform (Natural Language processing and Vision API)

I set up google cloud API (PHP) and to further authenticate my requests google suggested me like below:

First, ADC checks to see if the environment variable GOOGLE_APPLICATION_CREDENTIALS is set. If the variable is set, ADC uses the service account file that the variable points to.

If the environment variable isn't set, ADC uses the default service account that Compute Engine, Kubernetes Engine, App Engine, and Cloud Functions provide, for applications that run on those services.

If ADC can't use either of the above credentials, an error occurs.

I created a service account and download JSON and stored it on my server as suggested

After you've created the service account and set the environment variable, ADC is able to implicitly determine your credentials

Still I am getting the API key error like below:

Screenshot of Error

Adding Screenshot of Env variable that i had set on my server

ENV variable screenshot

2

2 Answers

1
votes

setting up the env variable "GOOGLE_APPLICATION_CREDENTIALS" under "/etc/apache2/envvars" solved the issue. spent a day on it. hope this helps fellow developers :)

0
votes

did you set GOOGLE_APPLICATION_CREDENTIALS environment variable? https://cloud.google.com/docs/authentication/getting-started