找不到电子邮件的 gaia ID,Google.Cloud.TextToSpeech.V1

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

我尝试在我的 c# 项目中使用 Google.Cloud.TextToSpeech.V1

我注册了谷歌云,添加了一个项目 进行 gcloud init 并创建本地 ADC gcloud auth 应用程序默认登录 --impersonate-service-account [电子邮件受保护]

当我调试下面的代码时,在 client.SynthesizeSpeech 调用时出现错误

Google.Apis.Auth.OAuth2.Responses.TokenResponseException
  HResult=0x80131500
  Message=Error:"{
  "error": {
    "code": 404,
    "message": "Not found; Gaia id not found for email [email protected]",
    "errors": [
      {
        "message": "Not found; Gaia id not found for email xxx.com",
        "domain": "global",
        "reason": "notFound"
      }
    ],
    "status": "NOT_FOUND"
  }
}
...
var client = new TextToSpeechClientBuilder
{
    GrpcAdapter = RestGrpcAdapter.Default
}.Build();


SynthesisInput input = new SynthesisInput
{
    Text = "Hello"
};

VoiceSelectionParams voiceSelection = new VoiceSelectionParams
{
    LanguageCode = "en-US",
    SsmlGender = SsmlVoiceGender.Male
};

AudioConfig audioConfig = new AudioConfig
{
    AudioEncoding = AudioEncoding.Linear16,
    SampleRateHertz = 22050,
};
SynthesizeSpeechResponse response = client.SynthesizeSpeech(input, voiceSelection, audioConfig);
using (Stream output = File.Create("c:/temp/sample.wav"))
{
    // response.AudioContent is a ByteString. This can easily be converted into
    // a byte array or written to a stream.
    response.AudioContent.WriteTo(output);
}

我怎样才能摆脱这个错误。

c# google-cloud-platform text-to-speech google-text-to-speech
1个回答
0
投票

Gaia 是 Google 的内部身份管理服务。

服务帐户电子邮件地址采用多种形式,但您通常希望看到以下形式的内容:

{account}@{project}.iam.gserviceaccount.com
;您无法使用 Gmail 帐户作为服务帐户电子邮件,这就是您收到此模糊错误的原因。

请参阅使用服务帐户模拟以获取全面指南。

© www.soinside.com 2019 - 2024. All rights reserved.