Unanswered question

Getting error though used Base64 Library to extract the details from JWT token?

I went through this question:
http://answers.neotys.com/questions/2587608-javascript-decode-jwt-token

Im trying to decode jwt token and have to use the details available in the Payload(second header).
I'm hitting jwt.io and sending my token in POST request as Text but its not working and no response
Could you please share more details ?

K K.
K K.

K K.

Level
0
15 / 100
points

Answers

Nouredine A.
Nouredine A.

Nouredine A.

Level
4
5000 / 5000
points
Team

In the post you mention there's link to another post where you have a project containing the base64.js to decode base64 content.

You need to import that base64.js in your NeoLoad project under menu "Edit->JS Libraries

Then as an example you can use the JS code below to decode your payload included in your jwt token. Here the token is hardcoded but of course you can get it from a NeoLoad variable if needed.


var token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c";

var payload = token.split('.')[1];

var DecodedPayload = Base64.decode(payload);
logger.debug("PostComputedValue = "+DecodedPayload);