Migrate my Node.JS to new Home Asssistant Auth System

Continuing the discussion from 0.77: Authentication system :policeman:โ€โ™‚ + Hangouts bot :robot::

In the thread I linked above, I once said that I insist in using trusted_networks to make it easier for my Node.JS file to interact with Home Assistant when using Plex webhook. In any case, if I were to transition to 0.77 with the new auth system in place, what should I do to make my Node.JS file work with Home Assistant?

Hereโ€™s a portion of the code:

// imports and variables above
app.post('/', upload.single('thumb'), function (req, res, next) {
  var payload = JSON.parse(req.body.payload);
  var cURL = "http://localhost:8123/api/";
  var json = { "entity_id": "light.living_room_floor_lamps" };
  var cType = "application/json";
  var ha_passwd = "";

  console.log('Got webhook for ', payload.event + ", UUID " + payload.Player.uuid );
  res.sendStatus(200);
  if(payload.Player.uuid == "b50dc01595f2f53d-com-plexapp-android")
  {
    if(payload.event === 'media.play' || payload.event === 'media.resume')
    {
      console.log("Media is playing.");
      request({
        url: cURL + "services/light/turn_off",
        method: "POST", json: true, body: json,
        headers: { "x-ha-access" : ha_passwd, "Content-Type": cType }
      }, function(error, response, body) { console.log(body); });
    }
    // media.pause continues below and similar to media.play as above

How would I get a token?

I am staying with 0.74 until I can get Node.JS updated with the new auth system. In other words, โ€œif it ainโ€™t broke, donโ€™t fix it.โ€

DO NOTHING. You are using x-ha-access, that means you have configured api_password. Nothing will break here.