Kumar
Kumar

Reputation: 1

Jmeter- Bearer error="invalid_token", error_description="The token expired"

I recorded a script using jmeter. When I run the script i'm getting `

Bearer error="invalid_token", error_description="The token expired" error.

Any ideas on how to fix it?

Upvotes: 0

Views: 694

Answers (1)

Dmitri T
Dmitri T

Reputation: 168217

In the majority of cases you cannot just replay a recorded script without doing prior correlation of the dynamic parameters.

Most probably you've recorded an Authorization Bearer header and the token within this header has a limited time to live so you will be able to replay the scenario successfully only for a limited time (normally 1 hour)

The "idea to fix it" would be implement fetching the "fresh" token, when you perform the log in the application responds with the token so you need to

  1. Extract it using a suitable JMeter's Post-Processor and save it into a JMeter Variable
  2. Replace recorded token value with the variable from step 1

Upvotes: 1

Related Questions