无法使用凭据选项设置谷歌语音构造器

问题描述 投票:0回答:1

您好,我尝试不使用json方法,而是使用凭据选项来启动gcloud语音客户端。

         const speech = require('@google-cloud/speech');

         const client = new speech.SpeechClient({credentials:{private_key : "", client_email: ""}}});

但是这给了我错误:3 INVALID_ARGUMENT:请求包含无效的参数错误。

我以相同的方式使用了对话流和其他服务,并且运行良好,请告知我是否在这里缺少任何内容。

google-speech-api google-speech-to-text-api
1个回答
0
投票

您可以尝试:

   const speech = require('@google-cloud/speech');
   const config = { projectId: 'your-project', keyFilename:'key.json'};
   const client = new speech.SpeechClient(config);
© www.soinside.com 2019 - 2024. All rights reserved.