6

I'm trying to extract access token from the body response and use it in Header Manager for authorization. The response of the first request is Response

Then I use regular expression for extracting the token Json Extractor

Then I enter a variable into the Header Manager Header Manager

But when I run the script I receive an error: Listener

Also, I get an error: 2019-02-09 23:45:57,822 ERROR o.a.j.e.j.j.JSONPostProcessor: Error processing JSON content in JSON Extractor, message: Use bracket notion ['my prop'] if your property contains blank characters. position: 2 Error I assume that json path is incorrect

I have already researched a lot of questions here but they didn't help me What is wrong in my actions? Thanks for the response in advance!

UBIK LOAD PACK
  • 33,980
  • 5
  • 71
  • 116
Andrew Chichick
  • 89
  • 1
  • 3
  • 8

2 Answers2

10

Use JSON Path Expressions as $.access_token

enter image description here

Masud Jahan
  • 3,418
  • 2
  • 22
  • 35
4

You're using a Regular Expression inside a JSON Extractor, that's your problem.

You must use JSON Path expression instead.

So correct value for JSON Path Expressions is:

$.access_token

Since you have in "Names for created variables" token, you can then use it with:

${token}

nothingisnecessary
  • 6,099
  • 36
  • 60
UBIK LOAD PACK
  • 33,980
  • 5
  • 71
  • 116