How to login with Vault from node app (token auth)?

Hello everyone,

Login with Vault must be done manually (via the CLI command or the UI) ? or can we do it from the app (via request on route) ?

What is the right syntaxe to do so (i use node-vault) ?
I try many variations of this, but can’t find the right one.

vault.request({ path: '/v1/auth/token', method: "PUT", headers: { "X-Vault-Token":"s.DaIjPGO5zQfo432gsCm0aTQV" } })
.then (res => {
	console.log('/auth/:token ', res);
.catch((err) => {
	console.log("\n     errrrrrreur token header ");

How do you want your node app to authenticate to Vault?
You’ll need to get a token from one of the auth methods, like approle:

Node would use the secret/role IDs to auth to Vault and get a token. You can provide that secret/role ID via your build pipeline, variables, a file, etc.

1 Like