Dashboard using basic authentication (Node-RED default - httpNodeAuth
config), having an issue
preventing using Admin and Dashboard the same time in both
MacOS and iOS. You could
read
more here. As a result, if you have open Dashboard in Safari or this
App, you will not open Admin until restart Saftar/App. That means after
using Editor, you must use Dashboard on Safari to test the real dashboard.
To solve this, you
can to change Dashboard authentication to Middleware authentication
Change in Setting.js
- In .node-red/settings.js comment out "httpNodeAuth" to remove
basic authentication
- Uncomment "ui", change to:
ui: {
path: "ui",
middleware: require("./dashboard-auth.js")
},
Download js for middle ware
Credit to
[librae8226]:
https://github.com/node-red/node-red-dashboard/pull/209
Security for Node when remove httNodeAuth
Remove httpNodeAuth will expose your http node (like http POST node for
getting location, voice command). To protect these HTTP nodes, you could add
a function node to check for authorization:
- When sending http data (location or data), App still send a
authorization header based on dashboard and username. In msg object it
will be: msg.req.headers.authorization.
Data be like
- Extract above data and compare with this js code:
'Basic ' +
btoa('username:password').
Example in function node
if (msg.req.headers.authorization === 'Basic ' + btoa('username:password')){
// Correct username and password, process your code
return msg.payload
}