Reputation: 2901
I was trying to translate couple words using api but, response keep saying me that api is not valid. I installed api file from google, and used "private_key"
api file
{
"type": "service_account",
"project_id": "foo-246510",
"private_key_id": "10101010101",
"private_key": "-----BEGIN PRIVATE KEY-----
something something-----END PRIVATE KEY-----",
"client_email": "sample_email@com",
....
}
I use "something something" section between begin and end section. Did I wrong ? How we should use it ?
Upvotes: 0
Views: 1135
Reputation: 2893
Based on the API file content, I understand you created a service account. According to the documentation, you need to set an environment variable named GOOGLE_APPLICATION_CREDENTIALS and set it according to your OS by replacing [PATH] with the path file of your service account JSON file.
For instance: For Linux or macOS:
export GOOGLE_APPLICATION_CREDENTIALS="[PATH]"
For windows and powershell:
$env:GOOGLE_APPLICATION_CREDENTIALS="[PATH]"
For windows and command prompt:
set GOOGLE_APPLICATION_CREDENTIALS=[PATH]
Upvotes: 1