1

My testing website generates JWT token both in UI framework designed from angular CSS and backend APIs also generate JWT token which expires in 1 hour. I have to do a performance test for this website using Jmeter. What should be the prerequisites I have to take with both backend and frontend team. Because while recording the test of frontend and running in JMeter on every alternate request it generates either 403 or 401 response

1
  • How to generate json web token
    – user44206
    Mar 25, 2020 at 10:33

1 Answer 1

2

As per How do JSON Web Tokens work? article:

Whenever the user wants to access a protected route or resource, the user agent should send the JWT, typically in the Authorization header using the Bearer schema. The content of the header should look like the following:

Authorization: Bearer <token>

So you should design your test plan as follows:

  1. Open login page
  2. Perform login
  3. Extract JWT token using a suitable JMeter Post-Processor and save it into a JMeter Variable
  4. Add a HTTP Header Manager and configure it to send Authorization header with the value of Bearer ${JMeter Variable holding the token here}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.