How to add credentials to Advanced Edition V3 of Google translate API in Nodejs

252 views Asked by At

I can see some tutorials on using the v2 and they add the credentials here

 const translate = new Translate({project id and credentials});

How about the third v3? will it work just like this https://cloud.google.com/translate/docs/advanced/translating-text-v3#translating_input_strings without anything? i have been searching the whole internet I cant find any clear idea. If you have an idea about it please tell me.

1

There are 1 answers

0
Nestor On

By credentials did you meant setting up the service account? you can view the authentication setup here. *From creating a service account and key, to using them in the environment.

Also in the link you have provided, If you are looking for the variable to assign your project ID it is also mentioned in the documentation.

const projectId = 'YOUR_PROJECT_ID';
const location = 'global';
const text = 'text to translate';