Mah*_*din 0 rest google-authentication google-text-to-speech
所以我想通过我的 C++ 程序的简单 POST 请求来使用 Google Cloud Text to Speech,问题在于它们的身份验证。我确实按照他们提到的那样创建了一个服务帐户,并且获得了包含我的私钥的文件。但我不知道如何在我的 POST 请求中使用它来进行身份验证?
POST 网址:https://texttospeech.googleapis.com/v1beta1/text :synthesize 这是我的 POST 正文:
{ "audioConfig": { "audioEncoding": "LINEAR16", "pitch": "0.00", "speakingRate": "1.00" }, "input": { "text": "Hello World" }, "voice": { "languageCode": "en-US", "name": "en-US-Wavenet-E" } }
我发现我需要从以下链接创建 API 密钥凭证: https: //console.developers.google.com/apis/credentials?project=[your-project-name]
然后将“?key=[API_KEY]”附加到我的 POST url,身份验证问题就解决了!