Pre-request substitute environment variables

I have a pre-request script that looks like:

const auth0PostRequest = {
  url: 'https://burton.auth0.com/oauth/token',
  method: 'POST',
  header: 'Content-Type:application/json',
  body: {
    mode: 'raw',
    raw: JSON.stringify({"client_id":"{{mgt_client_id}}",
                         "client_secret":"{{mgt_client_secret}}",
                         "audience":"{{mgt_auth0_audience}}",
                         "grant_type":"client_credentials"})
  }
};

But when it runs I see that following request body in Postman Console.

{"client_id":"{{mgt_client_id}}","client_secret":"{{mgt_client_secret}}","audience":"{{mgt_auth0_audience}}","grant_type":"client_credentials"}

As can be seen, the script is expecting substitution of the variables between {{ }}

Hey @rkevinburton,

You would need to reference those values like this in the sandbox:

{
    "client_id": `${pm.environment.get("mgt_client_id")}`,
    "client_secret": `${pm.environment.get("mgt_client_secret")}`,
    "audience": `${pm.environment.get("mgt_auth0_audience")}`,
    "grant_type": "client_credentials"
}