How to Retrieve SessionAttribute

I’m still unable to parse the session value stored in one request into other.
I’ve two http requests
val scn = scenario(“Device”)
.feed(csvFeeeder)
.exec(http(“Auth Header gene)
.post(”/auth")
.headers(headers_0)
.formParam(“type”, “device”)
.check(headerRegex(“auth”,“device*”).saveAs(“authH”))
.check(status.is(401)))

.exec(http(“Signed Req”)
.post("/auth/oauth")
.headers(Map(
“x-id” → “${id}”,
“x-serial” → “${serial}”,
“Authorization” → test.dummy))
.formParam(“type”, “device”))

the test.dummy is a function which converts the saved string “authH” into some format and that converted output needs to be passed to the “Authorozation” header in my second request. for that purpose I’m using something like this

object test{
def dummy: String = {
val = (Here I need to get the saved authH session attribute)
— logic to convert into my required format–
return convertedString
}
}

I was unable to get the sessionAttribute there. Is there a way to get the sessionAttribute. Please HELP. I go through the Gatling documentation but could not find any solution

try “Authorization” → test.dummy("${authH"})

& let dummy take param

I tried passing the saved value as method parameter. But still, it did not work. I got 403. I should get a 200

I tried to print the parameter value in the test method. But, it just prints ${authH}

Is there anyway, that I can create a sessionAttribute object in my function and get the saved session attribute through that object?

are you using
"${authH}"

or

s"${authH}"

or

"""${authH}"""

I’m using “${authH}”. Anyway I am able to retrieve the session attribute like this
.header(“Authorization” , session=>test.dummy(session(“authH”).as[String]))