Decode JWT Token in Jmeter: This tutorial will help you in decoding JWT token and sent by a server to the client.

First how to identify the string is JWT token or some other String generated by Server.

  • If the string is JWT then string should contain 3 dots (header, body, Signature).

How to Decode JWT Token in Jmeter?

Recently most of the applications are using JWT for adding enough security to their application.

L;et us assume generated Jwt Token is like below

Create a BeanShell sampler with the below code

in the above bean shell sampler.

  • First getting the JWT token into bean shell sampler.
  • Then splitting the string with .(dot). JWT will having 3 sections (header,body,Signature).
  • Taking the first index of the created array (if you want to decode the header section then change the index from 1 to zero in bean shell sampler ).
  • Replacing all _ values with slash(/).
  • Doing base 64 decode and adding it to JMeter variables.

Executed the BeanShell sampler and below is the decoded response is below


If you want to capture values from JWT token the add JSON path extractor to a decoded variable from BeanShell sampler.

Also Read: How to add Parallel/Concurrent Requests in Jmeter

Also Read: Beanshell Assertion in Jmeter


How to Decode JWT Token in Jmeter?

Leave a Reply

Your email address will not be published. Required fields are marked *