http://localhost:1880/serialports used to return the list of serial ports for the server. But it seems changed and returns 'Unauthorized' when called. I know it works on the editor page, but I need to call this API from a UI page.
What is the things to have it return the list of ports?
When asking for help it is a good idea to provide information about your setup like
what device and OS are you running NR on?
what version of NR and node.js are you using? (you can get this from the node-red startup log)
are you using Docker or Home Assistant?
what browser are you using?
what user ID is used to run the command?
When I run that on my Mac, I get a reply in Safari, Firefox, Chrome and Brave ["/dev/tty.debug-console","/dev/tty.wlan-debug","/dev/tty.usbmodem1234561","/dev/tty.Bluetooth-Incoming-Port"]
The serialports endpoint is an internal admin endpoint provided by the serial node.
So, you have to have the serialport node available on the palette.
But it is an ADMIN endpoint and secured with the same settings as you Editor web page.
It would be a serious security issue generally to make that list avail to the USER space rather than the ADMIN space.
But as long as you are aware of that issue. If you still want the list, you should probably create a small plugin or custom node to bridge the data. Alternatively, use an exec node to get the data from the OS and make that available as an endpoint using http-in/http-response nodes.
Thank you. What you pointed out is the cause.
And yes, I understand the possible security issue. But the current scenario I'm working on is a local engineering web console for the serially attached equipments, so they can stay with those possibility.