This tutorial will help you in decoding JWT token and sent by server to 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).

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

lets assume generated Jwt Token is like below

Create a beanshell sampler with below code

in 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 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 bean shell sampler and below is the decoded response is below

if you want to capture values from JWT token the add json path extractor to decoded variable from beanshell sampler.



1 Comment

Leave a Reply

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