I have this issue too, it’s an absolute basic request to get an access token.
No collection or multiple requests. Only since latest update where we lost the intial value option.
Used postbot to confirm the post-response script. It even has a test to confirm the response value is set to the environment, and then i print to console. All good. But opening the environment tab and it’s not updated. Tried another request to use the variable in case it was a UI thing and it’s printing blank too.
const response = pm.response.json();
// Check if the response has the access_token
pm.test("Access token exists in response", function () {
pm.expect(response.access_token).to.exist;
});
// Save the access_token to an environment variable
pm.environment.set("access_token", response.access_token);
// Confirm that the access_token environment variable has been updated
pm.test("Access token environment variable is updated", function () {
pm.expect(pm.environment.get("access_token")).to.equal(response.access_token);
});
// Output the access_token environment variable to console
console.log("Access token:", pm.environment.get("access_token"));
Test results: both PASSED
passedAccess token exists in response
passedAccess token environment variable is updated