Flows not refrencing environment variables

I am using Postman (for desktop) v10.21.7

I had a flow setup (and I am sure this worked) but today I’m not winning. I have 3 environments of which Development is my default. I create a flow, select the “Send Request” and it shows the 3 variables to be populated. I select my Development Environment, then for the value of the variable I choose “Get Variable” - I am then getting “No variables found.”

Here’s a screenshot of the flow:

And here’s a screenshot of the Environment variables:

image

As seen above, the hostname variable does exist, yet, in the flow it’s as if does not recognize the variable. I’ve closed, restarted but no luck. Any ideas?

Hi @relaypatrol

The “Get Variable” block is for getting variables created in the flow using the “Create Variable” block. The variables will auto-populate if there is a variable with the same name in your environment selected.

Thank you @flows-daniel

My use case in this case is that I want to test various endpoints which relies on a multi-auth approach (application and user). During the auth process we obviously return some JWT tokens.

My idea was to create a flow that will:

  1. Collect the required variables from the environment. I think I have fixed this as it seems to now collect the information if I dont set a field value
  2. Upon success, it needs to look at the JSON response and save 2 environment variables from the response (appjwt etc)
  3. Run a 2nd request to authenticate the user (so again collect the user credentials from my environment but also use the appjwt that was updated in point 2
  4. Lastly, upon user authentication, it needs to also save the userJWT

This way I can run the flow and after that continue with the testing of endpoints in collections knowing that a user has been authenticated (and have the JWT and refreshes updated in my environment variables)

Previously I used a “test” on the auth calls in my collections but that still required me to run 2 seperate calls from the collection. It seems flow is created for this reason but I’m not sure how to achieve the saving of variables from responses in flow. Do you have an example / video / documentation for my use case (if even possible)?

@relaypatrol

We don’t currently have a way to persist values between flow runs within Postman(I’ll open a feature request for this).

Currently, Flows works well for:

  1. Using Postman’s built-in authentication tab on requests for auth
  2. Have a token saved in an Environment variable before the flow runs
  3. Get the token as part of the flow and consume the token in the flow (but it needs to fetch a new token each flow run)
  4. Store/fetch a value via a 3rd party API

As you mentioned, there are other ways in Postman to handle your use-case using either tests, pre-request scripts, or collection runner.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.