简体   繁体   English

“无法加载默认凭据”谷歌云机密管理器 - 使用 CLI 授权用户

[英]"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.

相关问题 谷歌云抛出错误:无法在 Nodejs 中加载默认凭据 - Google Cloud Throwing Error : Could not load the default credentials in Nodejs 无法加载默认凭据? (Node.js 谷歌计算引擎) - Could not load the default credentials? (Node.js Google Compute Engine) 如何在 Express Project 中使用 AWS Secrets Manager 获取凭证? - How to use AWS Secrets Manager in Express Project for fetching Credentials? 初始化代码时使用 Google Cloud Secrets - Use Google Cloud Secrets when initializing code 无法加载默认凭据? (Node.js 谷歌计算引擎教程) - Could not load the default credentials? (Node.js Google Compute Engine tutorial) 在HTTP Google Cloud Function(NodeJS)中同步加载机密 - Synchronously load secrets in an HTTP Google Cloud Function (NodeJS) Google Cloud Print API:需要用户凭据 - Google Cloud Print API: User credentials required Google Cloud Secrets - 重用密钥 - Google Cloud Secrets - Reusing a secret 即使设置环境后也无法加载默认凭据 - Could not load the default credentials even after setting env Dialog api v2 - 获取应用程序默认凭据时出现意外错误:无法加载默认凭据 - Dialog api v2 - Unexpected error while acquiring application default credentials: Could not load the default credentials
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM