Jeankowkow
Jeankowkow

Reputation: 834

How to declare the `GOOGLE_APPLICATION_CREDENTIALS` environment variable?

I am trying the QuickStart project of the .NET Google Cloud Speech API Samples on my PC (Windows with Visual Studio 2017) but I can't figure where I have to define the GOOGLE_APPLICATION_CREDENTIALS that must contains the path to the JSON account key file.

When I run the project in Visual Studio 2017 it fails on this exception:

System.InvalidOperationException: 'The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.'

I have tried to define the GOOGLE_APPLICATION_CREDENTIALS environment variable in the system properties (under User variables and System variables) like that:

C:\GCP_ApiKey\MyFirstProject-599bf9a10431.json

But it doesn't work.

Where have I to define GOOGLE_APPLICATION_CREDENTIALS?

Upvotes: 0

Views: 5557

Answers (1)

Jeankowkow
Jeankowkow

Reputation: 834

In fact, I just had to restart the PC for the environment variable to be taken into account… 🙄

Upvotes: 3

Related Questions