GCP Iam authentication for vault in Node JS

Viewed 153

I was successfully connect to vault from my Nodejs application using token

process.env.DEBUG = 'node-vault'; // switch on debug mode
    var options = {
    apiVersion: 'v1', // default
    endpoint: 'https://vault..com', // default
    token: 's.0UzXXXX', // optional client token; can be fetched after valid initialization of the server
    namespace: 'xyz/ind/',
    pathPrefix: '/kv/data',
    noCustomHTTPVerbs: true,
    rpDefaults: {
        strictSSL: false
    }
   };
const vault = require('./../src/index')(options);
   
vault.read('appName/dev').then((result) => {
    console.log(result.data.data);
}).catch((err) => {
    console.log('Erro occuered.');
    console.error(err.message);
});

I have 2 questions

  1. Faced an issue related to SSL previously, see the error below

    Request Error: Error: SSL Error: SELF_SIGNED_CERT_IN_CHAIN

So I added "strictSSL: false" PARAM. I know its a temporary fix .I have a valid certificate now,how can we add that certificate to this context?

  1. How can we connect to vault using GCP IAM . does an edit in the above method work?
0 Answers
Related