Http-request node not working

Hello there,

I try to use Axxon VMS endpoint API.

https://doc.axxonsoft.com/confluence/display/next436en/HTTP+API

A simple info with server:

curl:

vamp@ubuntu:~$ curl http://root:root@localhost:8000/hosts/DEBIAN

{
  "hostname": "DEBIAN"
  ,"domainInfo":
  {
    "domainName": "3518d676-c243-47d7-9530-4c2edbf71c80"
    ,"domainFriendlyName": "test"
  }
  ,"platformInfo":
  {
    "machine": "x86_64"
    ,"os": "Linux"
  }
  ,"licenseStatus": "OK"
  ,"timeZone": 120
}

wget:

vamp@ubuntu:~$ wget -O -  http://root:root@localhost:8000/hosts/DEBIAN
--2020-06-05 13:41:13--  http://root:*password*@localhost:8000/hosts/DEBIAN
localhost (localhost) feloldása… 
Csatlakozás a következőhöz: localhost (localhost)[]:8000… kapcsolódva.
HTTP kérés elküldve, várakozás válaszra… 401 Unauthorized
Hitelesítés kijelölve: Basic realm="AxxonNext"
Csatlakozás a következőhöz: localhost(localhost)[]:8000… kapcsolódva.
HTTP kérés elküldve, várakozás válaszra… 200 OK
Hossz: 259 [application/json]
Mentés ide: „STDOUT”

-                                            0%[                                                                                       ]       0  --.-KB/s
{
  "hostname": "DEBIAN"
  ,"domainInfo":
  {
    "domainName": "3518d676-c243-47d7-9530-4c2edbf71c80"
    ,"domainFriendlyName": "test"
  }
  ,"platformInfo":
  {
    "machine": "x86_64"
    ,"os": "Linux"
  }
  ,"licenseStatus": "OK"
  ,"timeZone": 120
}

-                                          100%[======================================================================================>]     259  --.-KB/s    idő 0s

2020-06-05 13:41:13 (27,4 MB/s) --  kiírva a szabványos kimenetre [259/259]

But http_reguest node get this:

msg : Object
object
_msgid: "4c1bbed.e572a4"
topic: ""
payload: ""
statusCode: 401
headers: object
access-control-allow-origin: "*"
connection: "Close"
www-authenticate: "Basic realm="AxxonNext""
x-node-red-request-node: "2eb3793b"
responseUrl: "http://localhost:8000/hosts/DEBIAN"
redirectList: array[0]

I use basic auth. on node. I also try to add auth. inside the link, but not work at all.

Any idea?

Is node-red running on the same machine as the API?

(To clarify, I mean the node-red server not the client browser)

Also, you could possibly try to set basic Auth in the headers with base64 encoded user:pass

Eg

Authorization: Basic cm9vdDpyb2l0

https://www.blitter.se/utils/basic-authentication-header-generator/

Nevermind, i found the problem...

in http-request node, i set the basic-auth, but in not enught...

Need a function node before http-request that set this in header:

msg.headers = {};
msg.headers['Authorization'] = 'Basic';
return msg;

I don't know why needed, but now it working...

Edit: Yes you wrote the sollution, but not need the base64 encoding, only set it to 'basic'.