Configuring the Postman collection
Configure the global settings of the imported PKIHub collection.
To configure the PKIHub collection
Click the PKIHub root node of the navigation tree.
In the content pane, select the Scripts tab and then Pre-request.
Paste the Pre-request authorization script described below.
Select the Variables tab.
Set the baseUrl variable values described below.
Click the Save icon to make the changes persistent.
Pre-request authorization script
Add the following pre-request script to generate an Authentication token before running any request.
const username =
"<subjectId>"
;
const password =
"<password>"
;
const idpUrl =
"<idpUrl>"
;
const baseUrl = pm.variables.get(
'baseUrl'
);
const encodedCreds = btoa(`${username}:${password}`);
const authHeader = `Basic ${encodedCreds}`;
console.log(baseUrl);
pm.sendRequest({
url: idpUrl +
"/idp/v1/tokens"
,
method:
'POST'
,
header: {
'accept'
:
'application/json'
,
'Authorization'
: authHeader
},
},
function
(err, res) {
pm.environment.set(
"apiKey"
, res.json());
});
Where each placeholder corresponds to the following value.
<value> |
Value |
<subjectId> |
The Subject ID value obtained in Getting API credentials. |
<password> |
The Password value obtained in Getting API credentials. |
<idpUrl> |
The Identity Provider (Id) URL value obtained in Getting API credentials . |
baseUrl variable
Initialize as follows the baseUrl variable.
Variable |
Initial value |
Current value |
baseUrl |
Clear this value and leave the column empty |
Paste the RAW Signer URL value obtained when Getting API credentials . |