[英]"Could not load default credentials" google cloud secrets manager - use CLI authorized user
I would like to have my nodeJS
application authenticate itself locally with my IAM
credentials, however when I run the basic secrets manager
function below:我想让我的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
I receive the error:我收到错误:
Could not load the default credentials.无法加载默认凭据。 Browse to https://cloud.google.com/docs/authentication/getting-started for more information.浏览到https://cloud.google.com/docs/authentication/getting-started了解更多信息。 at GoogleAuth.getApplicationDefaultAsync在 GoogleAuth.getApplicationDefaultAsync
I can't seem to find any documentation on how to use my CLI
login credentials locally, any ideas ?我似乎找不到任何关于如何在本地使用我的CLI
登录凭据的文档,有什么想法吗?
(I don't want to use a JSON service account config) (我不想使用 JSON 服务帐户配置)
Even if you're authenticated with the gcloud
CLI
you need to set the default application login .即使您通过gcloud
CLI
进行了身份验证,您也需要设置默认应用程序登录。 This is solved by running gcloud auth application-default login
这可以通过运行gcloud auth application-default login
来解决
Source: Could not load the default credentials?来源: 无法加载默认凭据? (Node.js Google Compute Engine tutorial) (Node.js 谷歌计算引擎教程)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.