giefferre / texttospeech

Google Cloud Text-to-Speech API Client Library for Go
MIT License
3 stars 0 forks source link

rpc error: code = Unauthenticated desc #1

Open azharkhn opened 6 years ago

azharkhn commented 6 years ago

I am getting following error after executing the following command:

# go run synthesize.go en "Hello world" output.mp3

rpc error: code = Unauthenticated desc = transport: oauth2: cannot fetch token: Post https://accounts.google.com/o/oauth2/token: read tcp 192.168.X.X:51422->216.58.207.109:443: read: connection reset by peer exit status 1

Can you please suggest any fix?

giefferre commented 6 years ago

Hi @azharkhn

Did you set the GOOGLE_APPLICATION_CREDENTIALS variable properly? And, if yes, are the credentials valid and enabled for the specific Cloud Text-to-Speech API?

In your Google Project you have to enable the Text-to-Speech APIs here, then create a valid service account, then download its relative credentials.

Please let me know if this helps.