Workflows

How to extract value of an authentication token from a login response body and pass in subsequent request as ‘Bearer Token’?

Given the response from the authentication server:

{
    "accessToken": "foo",
    "refreshToken": "bar"
    "expires": "1234"
}

Extract the value of the token from the response in the Tests tab:

var jsonData = pm.response.json();
var token = jsonData.accessToken;

Set the token as a variable (global, environment, etc) so that it can used in later requests:

pm.globals.set('token', token);

To use the token in the next request, in the headers part the following needs to be added (key:value example below):

Authorization:Bearer {‌{token}}

How to create request parameterization from Excel or JSON file?

TODO