I am trying make a API call from Node-Red and it returns 'statusCode: 401'
The same API call from my browser and it is successful.
Why?
[
{
"id": "38ae1970b0adf818",
"type": "inject",
"z": "81a03fc837d2d50e",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 140,
"y": 140,
"wires": [
[
"e943e0c4e5782741"
]
]
},
{
"id": "e943e0c4e5782741",
"type": "function",
"z": "81a03fc837d2d50e",
"name": "function 42",
"func": "let gateway = 'lemkelabs-5031395368184750'\n\n\nmsg.url = \"https://eu1.cloud.thethings.network/api/v3/gs/gateways/\" + gateway + \"/connection/stats\"\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 310,
"y": 140,
"wires": [
[
"278737cf884c5a83"
]
]
},
{
"id": "278737cf884c5a83",
"type": "http request",
"z": "81a03fc837d2d50e",
"name": "",
"method": "GET",
"ret": "obj",
"paytoqs": "ignore",
"url": "",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 510,
"y": 140,
"wires": [
[
"73eb1bc0464ce853"
]
]
},
{
"id": "73eb1bc0464ce853",
"type": "debug",
"z": "81a03fc837d2d50e",
"name": "debug 324",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 690,
"y": 140,
"wires": []
}
]