# HTTP request - digest auth?

**URL:** https://discourse.nodered.org/t/http-request-digest-auth/3854
**Category:** FAQs
**Created:** [10 October 2018 10:27 UTC](https://discourse.nodered.org/t/http-request-digest-auth/3854 "2018-10-10T10:27:20Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![wdmnn](https://avatars.discourse-cdn.com/v4/letter/w/7ba0ec/32.png) [@wdmnn](https://discourse.nodered.org/u/wdmnn)
#### Post date: [10 October 2018 10:27 UTC](https://discourse.nodered.org/t/http-request-digest-auth/3854/1 "2018-10-10T10:27:20Z")

</div>

Hi everyone,

first post in this forum for me, so don't be too harsh 🙂

I had a flow running which sent me a picture of my webcam to a telegram chanel once a motion detector sensed motion. This was working fine until the webcam died and I had to replace it with a new model.  
Now obviously the HTTP request node does not work anymore - I suspect it's due to the new camera requiring digest auth instead of basic?!

The new cam (Wansview W2) can be accessed via [http://user:pass@192.168.178.xx/mjpeg/snap.cgi?chn=1](http://user:pass@192.168.178.xx/mjpeg/snap.cgi?chn=1)  
this works perfectly fine in a browser.  
Trying to run this command via the HTTP request node fails, no matter if I provide user:pass within the url or via the basic auth boxes.  
Trying to nail the issue down I tried it with curl:  
`curl http://user:pass@192.168.178.xx/mjpeg/snap.cgi?chn=1` results in a 401 unauthorized  
`curl http://user:pass@192.168.178.xx/mjpeg/snap.cgi?chn=1 --digest` works fine

Now the question is: How can I get this running in Node-Red? 😉

Any help is apprecitated.

Thanks

---

<div class="post-metadata">

### Author: ![TheSauce](https://avatars.discourse-cdn.com/v4/letter/t/3bc359/32.png) [@TheSauce](https://discourse.nodered.org/u/TheSauce)
#### Post date: [11 October 2018 00:29 UTC](https://discourse.nodered.org/t/http-request-digest-auth/3854/2 "2018-10-11T00:29:15Z")

</div>

Would this do the trick? It supports digest authentication.

> **[node-red-contrib-httpauth](https://flows.nodered.org/node/node-red-contrib-httpauth)**
>
> Node which implements HTTP Basic/Digest Authorization.

---

<div class="post-metadata">

### Author: ![wdmnn](https://avatars.discourse-cdn.com/v4/letter/w/7ba0ec/32.png) [@wdmnn](https://discourse.nodered.org/u/wdmnn)
#### Post date: [11 October 2018 07:12 UTC](https://discourse.nodered.org/t/http-request-digest-auth/3854/3 "2018-10-11T07:12:16Z")

</div>

As far as I understood the httpauth node it only supports digest for incoming http requests TO Node-Red. What I was looking for is outgoing requests FROM Node-Red.

I have solved the issue by running the curl in an exec node and storing the image temporarily:

```
[
    {
        "id": "9bc395e2.696468",
        "type": "exec",
        "z": "77b6ee06.c70d8",
        "command": "curl http://user:pass@IP/mjpeg/snap.cgi?chn=1 --digest -o /tmp/cam.jpg",
        "addpay": false,
        "append": "",
        "useSpawn": "false",
        "timer": "",
        "oldrc": false,
        "name": "CURL",
        "x": 390,
        "y": 200,
        "wires": [
            [],
            [
                "6510e24d.78b2fc"
            ],
            []
        ]
    },
    {
        "id": "6510e24d.78b2fc",
        "type": "delay",
        "z": "77b6ee06.c70d8",
        "name": "",
        "pauseType": "delay",
        "timeout": "1",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 520,
        "y": 200,
        "wires": [
            [
                "9a5d8fc6.92ea88"
            ]
        ]
    },
    {
        "id": "9a5d8fc6.92ea88",
        "type": "file in",
        "z": "77b6ee06.c70d8",
        "name": "",
        "filename": "/tmp/cam.jpg",
        "format": "",
        "sendError": true,
        "x": 690,
        "y": 200,
        "wires": [
            [
                "5ab9f6c4.aa642"
            ]
        ]
    },
    {
        "id": "5ab9f6c4.aa642",
        "type": "change",
        "z": "77b6ee06.c70d8",
        "name": "Set Headers",
        "rules": [
            {
                "t": "set",
                "p": "headers",
                "pt": "msg",
                "to": "{}",
                "tot": "json"
            },
            {
                "t": "set",
                "p": "headers.content-type",
                "pt": "msg",
                "to": "image/jpg",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 870,
        "y": 200,
        "wires": [
            [
                "a8a65b8b.e2cf7"
            ]
        ]
    }
]
```
