![](/img/trans.png)
[英]Google Cloud Throwing Error : Could not load the default credentials in Nodejs
[英]"Could not load default credentials" google cloud secrets manager - use CLI authorized user
我想让我的nodeJS
应用程序使用我的IAM
凭证在本地进行身份验证,但是当我运行下面的基本secrets manager
function 时:
// config/secret_manager.js
const { SecretManagerServiceClient } = require('@google-cloud/secret-manager')
const client = new SecretManagerServiceClient()
async function getSecret(name) {
const [version] = await client.accessSecretVersion({ name })
const secretValue = JSON.parse(version.payload.data.toString())
return secretValue
}
module.exports = getSecret
我收到错误:
无法加载默认凭据。 浏览到https://cloud.google.com/docs/authentication/getting-started了解更多信息。 在 GoogleAuth.getApplicationDefaultAsync
我似乎找不到任何关于如何在本地使用我的CLI
登录凭据的文档,有什么想法吗?
(我不想使用 JSON 服务帐户配置)
即使您通过gcloud
CLI
进行了身份验证,您也需要设置默认应用程序登录。 这可以通过运行gcloud auth application-default login
来解决
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.