JWT Authentication, Encoding a LocationToken

Viewed 22

I'm working an external API in which there is a locationToken. With this, I use it to create encoded data which I will use within my Bearer.

I am creating the data as such:

var data = {
  "locationToken": postman.getEnvironmentVariable("LocationToken"),
  "timestamp": Math.floor(new Date().getTime() / 1000)
};


data = addIAT(data);

With this data, i'm then encoding it using stringify then Cyrpto:

var stringifiedData = CryptoJS.enc.Utf8.parse(JSON.stringify(data));
var encodedData = base64url(stringifiedData);

postman.setEnvironmentVariable("locationTokenData", encodedData);

Strangely, within this it will always come out as, please note the NhdGlvblRva

eyJsb2NhdGlvblRva2VuIjoiZXlKMGVYQWlPaUpLV ----- etc

However, if I run it through their automatic documentation sample it comes with:

eyJpYXQiOjE2NjE2OTQyNzksInRpbWVzdGFtcCI ------ etc

I can confirm it is linked to the same account, same area, same details etc, however there appears to be an issue with how i'm passing this data. Can anyone let me know what's incorrect? Why is this string always occuring: NhdGlvblRva

0 Answers
Related