NR 3.1.11 working on Raspberry pi
I wanted to secure access to the Node Red editor by uncommenting the Security>adminAuth part in settings.js and change the with Hash security password by mine.
And since then, when I launch my Node Red editor with my credentials, my HTTP request Get node, to display settings of NR ...
it return an unauthorized message code 401:
payload: "Unauthorized"
topic: ""
myIp: "192.168.1.54"
statusCode: 401
headers: object
access-control-allow-origin: "*"
www-authenticate: "Bearer realm="Users""
date: "Wed, 19 Jun 2024 10:44:07 GMT"
connection: "close"
content-length: "12"
x-node-red-request-node: "c48843e0"
responseUrl: "http://192.168.1.54:1880/settings"
redirectList: array[0]
retry: 0
Maybe I made a mistake in the type of credentials? basic authentication?
I tried Digest authentication and it returns “Bad Request”
You can try with this flow after changing the IP address of your NR server and the credentials of the NR publisher
[
{
"id": "503b84433ddbc4f5",
"type": "http request",
"z": "1dec9bbc.37a314",
"name": "installedVersion",
"method": "GET",
"ret": "obj",
"paytoqs": "ignore",
"url": "http://192.168.1.54:1880/settings",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "basic",
"senderr": false,
"headers": [],
"x": 810,
"y": 1650,
"wires": [
[
"5666227af19759e8",
"bcb627c8cf5e0ef3"
]
],
"info": "http://192.168.1.54:1880/settings"
},
{
"id": "5666227af19759e8",
"type": "debug",
"z": "1dec9bbc.37a314",
"name": "NRversion buff",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1010,
"y": 1680,
"wires": []
},
{
"id": "a44a30ce418c0458",
"type": "inject",
"z": "1dec9bbc.37a314",
"name": "verif new Version 12h",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "43200",
"crontab": "",
"once": true,
"onceDelay": "20",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 750,
"y": 1710,
"wires": [
[
"503b84433ddbc4f5"
]
],
"info": "360h = 15days\n168h = 7 days"
},
{
"id": "bcb627c8cf5e0ef3",
"type": "function",
"z": "1dec9bbc.37a314",
"name": "actualVersion",
"func": "//let str = msg.payload;\n\nlet actualVersion = msg.payload.version;//str.substring(31,36);\nmsg.actualVersion = \"v\"+actualVersion;\nreturn msg",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 970,
"y": 1600,
"wires": [
[
"ea2c4e06c8072d4a"
]
]
},
{
"id": "ea2c4e06c8072d4a",
"type": "debug",
"z": "1dec9bbc.37a314",
"name": "NRversion",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1030,
"y": 1640,
"wires": []
}
]
Thanks to those who can help me