It does, but you can’t console log or access the variables directly in scripts.
Please see my earlier post with example screenshots.
It does, but you can’t console log or access the variables directly in scripts.
Please see my earlier post with example screenshots.
Ah, you can’t even resolve the vault secret via an environment variable in a script! Understood.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
To use the pm.vault
methods in scripts to access or manipulate your vault secrets, you must first enable this option from your Postman Vault.
The pm.vault
methods run asynchronously in your scripts. Each method also returns a Promise object that represents the completion or failure of the method. Add the await
operator before each pm.vault
method to wait for the Promise and its resulting value. Note that a method without the await
operator may run in your script, but it may not behave as expected.
For example:
console.log(await pm.vault.get("secretKey"));
await pm.vault.set("secretKey", "newValue");
await pm.vault.unset("secretKey");
Full information can be found here: