Forum Discussion
CarlosValcarcel
Staff
3 days ago${#Project#Token} always reads the Project property, which never changes when you switch Environments.
When Environments are enabled, the value you set on the Environment lives in the Environment’s Custom Properties and is accessible as ${#Env#Token}. It does not override the Project property.
You can do one of the following:
Use the environment scope in your header
Authorization: Bearer ${#Env#Token}
Write the token into the Project property as well (so your existing ${#Project#Token} keeps working):
def proj = context.testCase.testSuite.project proj.setPropertyValue('Token', newToken)
// if you also keep an env value:
proj.getActiveEnvironment()?.setPropertyValue('Token', newToken)
- Or auto-sync after you fetch the token
Add a Property Transfer (or a Groovy step) that copies Env.Token -> Project.Token.
Let me know if that helps!