Chamani Thakshila
Chamani Thakshila

Reputation: 1

How to use Jmeter response parameter for another request input parameter

  1. I want to use response, refresh_token value as next request input parameter.

Response body parameter

  1. I added Regular Expression Extractor there.

Regular Expression extractor

  1. I called for regular expression extractor parameter as below on next request.

Call parameter

  1. But still getting invalid refresh token error.

Error

Upvotes: 0

Views: 1234

Answers (3)

Ceesiebird
Ceesiebird

Reputation: 706

This issue has a checklist of things to check for the error you are getting.

Using Refresh Token Exception { "error" : "invalid_grant" }'

Hope it helps.

I think the issue might be with the missing bearer type prefix, try extracting the bearer type as well

Information won from the following source: https://security.stackexchange.com/questions/108662/why-is-bearer-required-before-the-token-in-authorization-header-in-a-http-re

Upvotes: 0

Dmitri T
Dmitri T

Reputation: 168157

My expectation is that you need to use access_token, not the refresh_token. Refresh Tokens are required only when your access token is expired as requesting a new access_token using the refresh_token is a way faster and easier than doing full authentication.

Also be aware that it's better to use JSON Extractor to deal with JSON data, the relevant JSON Path query will be as simple as

$.access_token

See API Testing With JMeter and the JSON Extractor article for more information if needed.

Upvotes: 0

sunny_teo
sunny_teo

Reputation: 1999

You have use regular expression to fetch data from "Response Message". Instead, you need it from "Body". Change "Field to Check" from "Response Message" to "Body" in regular expression extractor.

Hope it helps.

Upvotes: 0

Related Questions