How to automatically set a Bearer Token for your Postman requests?

two lines of code actually, work for me Kindly add this in the test field

var res = pm.response.json();
pm.environment.set('token', res.data.token);

10 Likes