when I try to generate my JWT - I get a :ReferenceError: KJUR is not defined
this is the part of my pre-req script
function generateJwt() {
eval(pm.globals.get('jsrsasign-js')); // import javascript jsrsasign
var sHeader = JSON.stringify(header);
var sPayload = JSON.stringify(payload);
var JWT = KJUR.jws.JWS.sign(header.alg, sHeader, sPayload, jwtPrivateKey);
pm.environment.set('assertionToken', signedToken);
console.log('jwt', signedToken);
}
var navigator = {}; // fake a navigator object for the lib
var window = {}; // fake a window object for the lib
if (pm.globals.has('jsrsasign-js')) generateJwt();
else pm.sendRequest(
'https://kjur.github.io/jsrsasign/jsrsasign-all-min.js',
function (err, res) {
if (err) {
console.log(err);
} else {
pm.globals.set('jsrsasign-js', res.text());
generateJwt();
}});