is it possible to make my access token variable globally accessible

I have a URL after posting to which I get my access token

def Authorize(scenarioName: String) : ChainBuilder ={




.check(status is 200)




Now I want to make this saved "token " variable globally accessible.

Please suggest a way to do the same. complete code file is attached.

Thanks !!

token code.txt (1.3 KB)

Something like this (it is idea only!):
vat t=""

Your code here and:
.exec{ session =>
t = session(“token”) // Now you have token in “global” variable

Sorry, I don’t have computer now and can’t write correct code ^(

Hi … thanks for your suggestion. I tried but it gives error “reassignment of to variable” … so I tried below.
Can you please help me analyze it further.

below code in part of AuthorizationSimulation class

val tokenString = “”

.exec(session => {





Now while trying to access this variable in a different scala class of same project I get an error that variable is not found.

Below code is part of OrgFuncSimulation class

val sentHeaders = Map(“Content-Type”->“application/json”,“sourceName”->“MDM”,“destinationName”->“org360”,“Authorization”->AuthorizationSimulation.tokenString)