本文介绍了我正在使用gcp服务帐户,但在调用对话流api时却给出错误:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里有错误:


推荐答案

许多客户端库从中提取该链接提供了有关如何检查它们的摘要。本质上,它将检查环境变量的路径并从该位置提取凭证。此错误消息表示您使用的是用户帐户,而不是服务帐户。

Many of the Client Libraries pull from the Application Default Credentials, a summary of how they're checked is provided on that link. Essentially it will check environmental variables for a path and pull credentials from that location. This error message means you're using a User account, and not a service account.

通常情况下,您使用 gcloud auth登录,即使您提供了服务帐户,它仍然是从应用程序默认位置提取的。

Most commonly you logged in once using gcloud auth login, and even though you provided your service account it's still pulling from the Application Default location.

与您一样,关联特定服务帐户的方法为 gcloud auth activate-service-account --key-file< path>

As you did, the method to associate a specific service account is gcloud auth activate-service-account --key-file <path>

或者使用真实的应用程序默认值,您可以使用 gcloud auth应用程序-默认登录

Alternatively to use the true application default you can use gcloud auth application-default login

这篇关于我正在使用gcp服务帐户,但在调用对话流api时却给出错误:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 09:14