0
  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

m00am
  • 5,910
  • 11
  • 53
  • 69

3 Answers3

0

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

Ceesiebird
  • 696
  • 2
  • 11
  • 24
  • I am still checking for the one user verification. Yes. According to that list the reason may be 1. Refresh Token is not valid anymore or 2. Refresh Token is wrong. Unable to find the issue of the regular expression. Thank you – Chamani Thakshila May 30 '18 at 08:35
  • Maybe passing along the bearer type will work, please see the link in my comment above. – Ceesiebird May 30 '18 at 13:09
0

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.

sunny_teo
  • 1,961
  • 1
  • 7
  • 11
0

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.

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • I need refresh_token for the next request and it is working fine if I enter that value manually for the parameter without considering regular expression. – Chamani Thakshila May 30 '18 at 08:31
  • In this case move your Regular Expression Extractor to be **a child** of the `oauthtoken` request as JMeter PostProcessors obey [Scoping Rules](https://www.blazemeter.com/blog/jmeter-scoping-rules-the-ultimate-guide) and the value simply gets overwritten by the next request. And switch it to read from **Response Body** – Dmitri T May 30 '18 at 09:29