I have an environment specific secret value, for example an API key. I want to store this value in Postman Vault, but be able switch between keys when changing environments and reference only 1 variable. Is this possible?
environment: env1
my_api_key = {{vault:my_api_key_env1}}
environment: env2
my_api_key = {{vault:my_api_key_env2}}
Post request
Auth-header={{my_api_key}} (scope env)
Have you tried it? Sounds like it should work.
The variable from inside the environment value doesn’t get resolved and comes as a string {{vault:my_api_key_env1}}
You can’t console log it in scripts as it will show as a string.
You can’t retrieve the values in scripts either.
You can only use the vault values in certain places like the request body, authentication tabs, URL, etc.
This topic relates.
Access Postman Vault from Pre-Request Script - Help - Postman Community
system
(system)
Closed
July 21, 2024, 8:46am
5
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.