As mentioned by KBusc and inspired by these examples, you can accomplish your goal by installing a pre-query script, as shown below:
pm.sendRequest({ url: pm.environment.get("token_url"), method: 'GET', header: { 'Authorization': 'Basic xxxxxxxxxx==', } }, function (err, res) { pm.environment.set("access_token", res.json().token); });
Then you simply refer to {{access_token}} like any other environment variable.
source share