I\'m trying to send an authenticated request with one click in postman.
So, I have request named \"Oauth\" and I\'m using Tests to store the token in a local variable.>
As mentioned by KBusc and inspired from those examples you can achieve your goal by setting a pre-request script like the following:
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 just reference {{access_token}}
as any other environment variable.