Hashicorp Vault - Getting Started with Node.js node-vault

by
Jeremy Canfield |
Updated: November 26 2024
| Hashicorp Vault articles
This assumes the following has already been done.
Use the npm list command to determine if the node-vault package is installed.
~]$ npm list
nodejs_hashicorp_vault
@ /home/john.doe/nodejs_hashicorp_vault
└── node-vault@0.10.2
If the node-vault package is not listed, use the npm install command to install the node-vault package.
npm install node-vault
Here is the minimal boilerplate code needed to authenticate to Hashicorp Vault. In this example, the authentication is done using a token.
var options = {
apiVersion: 'v1',
endpoint: 'http://vault.example.com:8200',
token: 'hvs.CAESIAfdfIXuyXbXZCaDx7kSXpC04y4yPRhbTulQBGinXzbsGiUKHGh2cy5sb2lQZVFnRWVxQjdxak8yTkZUNVJUd0sQmM6ACRgI'
};
var vault = require("node-vault")(options);
Did you find this article helpful?
If so, consider buying me a coffee over at