Hello
I am try to capture a access token which I am redirecting to my localhost. There are multiple redirects and access token come from 3rd redirect call and 4th call is failing.
When I try to capture HTTP response header using “headerRegex” and “currentLocation” I am unable to capture it.
Your help is much appreciated.
Below is the piece of code I am using to capture access token
.exec(http(“CommonAuth”)
.post("/commonauth")
.header(“Content-Type”, “application/x-www-form-urlencoded”)
.formParam(“sessionDataKey”,"${sessiondata}")
.formParam(“password”,"")
.formParam(“user”,"")
.formParam(“username”,"")
.check(currentLocation.transform(s => {
val regexr = “”“access_token=([^&]+)”"".r
val locationKey = regexr findFirstIn s
locationKey.get
}
).saveAs(“accesstoken”)
))
I have to capture access token from below HTTP response URL which is in 3rd redirect.
https://localhost/#access_token=1dd59aa1f3dfb66e25c04458d5e77c7c&token_type=Bearer&expires_in=27043&session_state=7d021e118f1f89d57cd2ce15f78a815c4bb05884c5a0fe8082795104c24721ce.nOX1N7g_jK1g_ThEeWlNaQ
The error log is below:
Request:
CommonAuth: OK