Wirelesstag local url calling working wih new auth methods

I had URL calling set up over local address in the wireless tag web interface. In HA i had the wirelesstag component set up with my tag manager’s ip in trusted networks. Starting in .89 I noticed trusted networks is being moved to the new Authorization methods and won’t work without a user being selected at the login. so this won’t work with the url call from the tag manager any longer.

Problem is the tag manager hardware has a character limitation on the length of the urls so you can’t use a lone lasting auth token.

I did some searching and came upon this project: https://www.npmjs.com/package/json-proxy which lets you proxy a request and and also inject a header, so I set this up to add the Authorization header with the token. all seems to work!

now to figure out how to run this from a new hassio add-on so I don’t need to spin it up on another machine. Also this may help get around the local url calling not being able to handle https, I ended up proxying my hass to get around this, so on my local network it’s not https, but out side it is.

I run in with the config file option, and the file looks like this:

  "server": {
    "port": 9321,
    "webroot": "$config_dir",
    "html5mode": "/index.html"
  },
  "proxy": {
    "forward": {
      "/api/": "http://HASSIO_IP:8123"
    },
    "headers": {
      "Authorization: Bearer YOUR AUTH TOKEN"
    }
  }
}

the output should look like this once it’s up and running:


 #####  ####   ####  #    #       #####  #####   ####  #    # #   #
   #   #      #    # ##   #       #    # #    # #    #  #  #   # # 
   #    ####  #    # # #  # ##### #    # #    # #    #   ##     #  
   #        # #    # #  # #       #####  #####  #    #   ##     #  
#  #        # #    # #   ##       #      #   #  #    #  #  #    #  
####   #####   ####  #    #       #      #    #  ####  #    #   #  

proxy hosting local files from .
proxy forwarding ^\/api\/ --> HASSIO_IP:8123
proxy forwarding injects header "Authorization: Bearer AUTH TOKEN"
(node:14208) [DEP0027] DeprecationWarning: util.puts is deprecated. Use console.log instead.
proxy listening on port 9321
proxy: POST /api/events/wirelesstag_update_tags --> http://HASSIO_IP:8123/api/events/wirelesstag_update_tags
POST /api/events/wirelesstag_update_tags 200 91.862 ms - 51
proxy: POST /api/events/wirelesstag_update_tags --> http://HASSIO_IP:8123/api/events/wirelesstag_update_tags
POST /api/events/wirelesstag_update_tags 200 11.296 ms - 51
proxy: POST /api/events/wirelesstag_update_tags --> http://HASSIO_IP:8123/api/events/wirelesstag_update_tags
3 Likes