Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
816 views
in Technique[技术] by (71.8m points)

c# - Unable to set google api credentials

I am trying to use the google translation api in my application by following these instructions, but having some trouble setting up the authorisation.

I created the service account, got the json file, and set it in with

set GOOGLE_APPLICATION_CREDENTIALS="C:UsersBassieDocuments.credentialsgoogle-translation-apiMy Project-d885ebbbe907.json"

After running that command I don't see any output, and I don't see a system environment variable called GOOGLE_APPLICATION_CREDENTIALS (is that where it should appear?).

When I try running some basic sample code:

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.'

What am I doing wrong?

update

even after manually adding the value to system environment variables, I get the same error.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...