Environment variables and switching computers

Hello,

I regularly switch between 2 computers. This seems to cause an issue with my api-keys that I have set up in my environment variables and I have to regenerate them and re-insert them each time I switch.
Should I be able to set up my Postman API key and use it from both both computers or do I need to set one up for each computer? And if I switch between computers is there a way of the environment variable not being cleared.

Thanks

1 Like

API Keys are confidential bits of information, so they are usually stored as “secret” Environment variables, which means the values do not get copied to the Postman Cloud or when you export as JSON to save into your code repository. The values will not follow you around.

If you change the type to default, and then store the keys in the initial value, then they will follow you around, but it also means they will be copied to the Postman cloud.

You don’t have to regenerate them, but you will need to note them somewhere so you can re-add them in the current value when you move PC’s.

Use an encrypted password manager to store them.

I guess, you could create a new key for each PC, if that helps you identify where the keys are being used.

We use Microsoft Azure Pipelines in conjunction with Azure Key Vault. The API key is stored in the Azure Key Vault, and is the first thing the pipeline retrieves. When it calls the Newman command line, it sends the value along with it.

You can access the Key Vault directly and get the current value at any time, so we can use it locally with the Postman client.

2 Likes

Hey @turnerator !

Quick precision on what @michaelderekjones mentioned:

  • Setting the variable as “initial value” will allow you to have it synced through the Postman Cloud and therefore have access to it from any computer as long as you’re logged in to your account
  • Setting the type of variable to “secret” or “default” will not affect whether the variable is being synced or not

You can learn more about the different type of variables here: Using variables | Postman Learning Center

3 Likes

@arlem

ok, re-reading the instructions.

The secret type just masks the value on the screen.

The current value doesn’t get synced (no matter the type).

Gotcha.

2 Likes