Jmeter - BeanShell PostProcessor - import org.apache.commons.codec.binary.Base64;

 Jmeter - BeanShell PostProcessor - import org.apache.commons.codec.binary.Base64;

//Steps --->>> Use beanshell post processor from sampler add into the request and then add debug sampler here you can see response data tokens which are relevant for your next request 

import org.apache.commons.codec.binary.Base64;

//jwt_token is the variable declared in user defined variables

//generally we can get the corrlated value instead of jwt_token

String response = vars.get("jwt_token");

String[] arr=response.split("\\.");

String actualvalue=arr[1].replaceAll("-","+");

actualvalue=actualvalue.replaceAll("_","/");

byte[] decoded_response = Base64.decodeBase64(actualvalue);

// inserting decoded JWT token into B_IdToken

vars.put("B_IdToken",new String(decoded_response));

log.info(new String(decoded_response));

Comments