Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

How to use my own credential? #26

Closed
choongyouqi opened this issue Jun 13, 2018 · 4 comments
Closed

How to use my own credential? #26

choongyouqi opened this issue Jun 13, 2018 · 4 comments
Assignees
Labels
api: texttospeech Issues related to the googleapis/nodejs-text-to-speech API. 🚨 This issue needs some love. triage me I really want to be triaged.

Comments

@choongyouqi
Copy link

I'm hitting Cloud Text-to-Speech API has not been used in project 563584335869 before or it is disabled from the example. and interesting enough, 563584335869 is not one of my projects in gcloud projects list.

If we follow the structure of other @google-cloud/* apis, we should be able to pass in our keyFile as config:

var config = {
  projectId: 'grape-spaceship-123',
  keyFilename: '/path/to/keyfile.json'
};
var datastore = require('@google-cloud/text-to-speech')(config);

but it doesn't seem to accept any parameter at the moment.

@JustinBeckwith JustinBeckwith added the triage me I really want to be triaged. label Jun 13, 2018
@JustinBeckwith
Copy link
Contributor

Greetings! The default export of the module is a class type, which needs to be instantiated. For example:

// Imports the Google Cloud client library
const textToSpeech = require('@google-cloud/text-to-speech');

// Create the auth config
const config = {
  projectId: 'grape-spaceship-123',
  keyFilename: '/path/to/keyfile.json'
};

// Creates a client
const client = new textToSpeech.TextToSpeechClient(config);

Hope this helps!

@nicogon
Copy link

nicogon commented Nov 10, 2018

This should be included in the example

@lincolnlemos
Copy link

This should be included in the example 2x

@google-cloud-label-sync google-cloud-label-sync bot added the api: texttospeech Issues related to the googleapis/nodejs-text-to-speech API. label Jan 31, 2020
@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Apr 7, 2020
@JustinBeckwith JustinBeckwith self-assigned this Feb 1, 2021
@nolimitdev
Copy link

nolimitdev commented Dec 1, 2022

Now is 2022 and such as in 2018 in example e.g. https://cloud.google.com/text-to-speech/docs/samples/tts-synthesize-text#tts_synthesize_text-nodejs is missing any auth mention. Is it possible dear Google? How we could know that code from example new textToSpeech.TextToSpeechClient(); shout be new textToSpeech.TextToSpeechClient(config); ???

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: texttospeech Issues related to the googleapis/nodejs-text-to-speech API. 🚨 This issue needs some love. triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests

6 participants