Google Cloud Text To Speech REST API身份验证 [英] Google Cloud Text To Speech REST API Authentication

查看:149
本文介绍了Google Cloud Text To Speech REST API身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我想通过我的C ++程序的简单POST请求使用Google Cloud Text to Speech,问题在于它们的身份验证.正如他们提到的,我确实创建了一个服务帐户,并且得到了包含我的私钥的文件.但是我不知道如何在我的POST请求中使用它进行身份验证?

So I want to use the Google Cloud Text to Speech using a simple POST request from my C++ program, the problem is with their authentication. I did create a service account as they mentioned and I got the file containing my private key. But I don't know how can I use it in my POST request to be authenticated ?

POST网址: https://texttospeech.googleapis.com/v1beta1/text:synthesize 这是我的POST正文:

POST Url: https://texttospeech.googleapis.com/v1beta1/text:synthesize and here is my POST body:

{ "audioConfig":{ "audioEncoding":"LINEAR16", "pitch":"0.00", "speakingRate":"1.00" }, 输入": { "text":"Hello World" }, 嗓音": { "languageCode":"en-US", 名称":"en-US-Wavenet-E" } }

{ "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 = [您的项目名称]

I found out that I need to create an API Key Credential from the following link: https://console.developers.google.com/apis/credentials?project=[your-project-name]

,然后在我的POST网址后附加?key = [API_KEY]",身份验证问题已解决!

and then append "?key=[API_KEY]" to my POST url and the authentication problem is fixed !

这篇关于Google Cloud Text To Speech REST API身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆