I am trying to to use the @google-cloud/secret-manager
package to read secrets from inside an application, and I want it to authenticate with a specific service account, not the default credentials. I can't find any documentation anywhere on how to do this.
import { SecretManagerServiceClient } from '@google-cloud/secret-manager';
const smClient = new SecretManagerServiceClient();
There are no options anywhere in the docs to provide authentication parameters. I'm trying to even use the google-auth-library
to authenticate with my service account, but I'm not sure how to even pass that to the secret-manager request.
import { JWT } from 'google-auth-library';
const keyFile = JSON.parse(
fs.readFileSync(path.resolve(__dirname, '../service-account.json'))
)
const authClient = new JWT({
email: keyFile.client_email,
key: keyFile.private_key,
scopes: ['https://www.googleapis.com/auth/cloud-platform'],
});