Automatic token capture

Can anyone help me understand why my pre-request script is not defining the variable with the called token?

const echoPostRequest = {
  url: 'https://www.amilia.com/api/v3/authenticate/',
  method: 'get',
  header: `Authorization: Basic [base64]
};

pm.sendRequest(echoPostRequest, function (err, res) {
    const json = res.json()  
    pm.environment.set("token", json.token) 

I can see the correct token in the body being called when viewing the console. However, it is not adding the token to the variable in the authentication tab. Any help would be amazing. Thanks!