我想让我的nodeJS
应用程序使用我的凭据在本地进行身份IAM
验证,但是当我运行以下基本secrets manager
功能时:
// 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 服务帐户配置)