Http-request digest authentication

875 views
Skip to first unread message

Bart Ellast

unread,
Nov 28, 2016, 12:58:25 PM11/28/16
to Node-RED
Hello,

I have a Samsung IP camera that i want to get an image from using node red.
I does not seem to work because it is using Digest authentication.

The current http-request node only supports basic auth.

Is there another way i can make a resuest to a url using digest auth?

thx,
Bart

Mark Setrem

unread,
Nov 28, 2016, 1:23:02 PM11/28/16
to Node-RED
Have you tried using the contrib node that says it supports digest?

http://flows.nodered.org/node/node-red-contrib-httpauth

Bart Ellast

unread,
Nov 28, 2016, 2:00:25 PM11/28/16
to Node-RED
Yes, isn't this node for a different purpose?
I want to do a request to a url.

Doesn't that node authenticate an incoming http request TO node-red?

Ben Hardill

unread,
Nov 28, 2016, 5:24:37 PM11/28/16
to Node-RED
You can probably build your own authorize header in a function node before the http-request node and pass it in.

You will might need to add `crypto: require('crypto')` to your functionGlobalContext to get access to the MD5 hash but it should be relatively simple

Mark Setrem

unread,
Nov 28, 2016, 5:58:35 PM11/28/16
to Node-RED
Oops sorry my mistake, I remembered playing with it previously and thought it did both

Bart Ellast

unread,
Nov 29, 2016, 1:27:45 AM11/29/16
to Node-RED
Thank you Ben, but i have totally no idea how to begin that.

Mike Biddell

unread,
Nov 29, 2016, 3:46:43 AM11/29/16
to Node-RED
Bart

If you are trying to get the camera to send you a pic when motion is detected, node-red-contrib-ftp-server works. But depends on your use case and whether your cameras support ftp (most do).


mike

Bart Ellast

unread,
Nov 29, 2016, 3:51:00 AM11/29/16
to node...@googlegroups.com

Mike,

 

I have a videophone that sends a udp packet when someone rings. I currently have this set-up to send an image of all cctv camera’s with view of a main gate.

This works fine, but we added new Samsung camera’s.

With these samsung’s it does not work anymore. This Is because of the Digest auth I think.

 

I actually used a home automation device to do this, but as this also failes I thought it would be possible implementing with node-red.

 

Doesn’t seem as simple as I thought though J

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/3pjs1uTUzNw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/81187a83-2669-41f2-a511-c000c335c154%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mike Biddell

unread,
Nov 29, 2016, 4:15:14 AM11/29/16
to Node-RED
mmmm

bit tricky that..... I have a single camera pointing out over my drive and on motion detect, it sends the image into node via FTP. I then turn on "cyber-dog" and at night, some lamps in my lounge. I suspected your use case might be different. You might be able to do something with motion detect, because if no motion is detected it's pointless taking the UDP snapshot, if you see what I mean ??? You could set all the cameras to FTP on  motion and if they 'see' something, the snapshot WILL contain something worth seeing.

Mike

Nicholas O'Leary

unread,
Nov 29, 2016, 4:24:06 AM11/29/16
to Node-RED

Hi Bart,

Do you have a link to any docs for your device. Will help us to understand the specific requires around the digest auth. It will be possible to do... just depends on the fine details!
Nick


You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.

To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

Julian Knight

unread,
Nov 29, 2016, 4:27:45 AM11/29/16
to Node-RED
Can you get an image using CURL? Manually. That would at least let you know you are on the right track. Worse case then would be to do it from the command line called from NR.


On Tuesday, 29 November 2016 08:51:00 UTC, Bart Ellast wrote:

Bart Ellast

unread,
Nov 29, 2016, 5:49:46 AM11/29/16
to Node-RED
Julian,

I have no real experience with curl.
However, using this command:

 curl -m 10 --digest -u "admin:XXX" -o test.jpg http://192.168.1.153/cgi-bin/video.cgi?msubmenu=mjpg



I get a jpg file which i can open with vlc (so no image lol). So that works!

Nick,

This is the camera in question:
I do not have a lot of info apart from the datasheet.

Bart Ellast

unread,
Nov 29, 2016, 6:15:55 AM11/29/16
to Node-RED
Ok, so i basically got it to work.

[{"id":"3db8e9d3.a28286","type":"e-mail","z":"894c465c.5897a8","server":"smtp.gmail.com","port":"465","name":"te...@test.com","dname":"","x":1140,"y":300,"wires":[]},{"id":"9245d236.2d5b9","type":"inject","z":"894c465c.5897a8","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"x":90,"y":300,"wires":[["3fa12b11.a1bac4"]]},{"id":"3955c3d6.3a5e7c","type":"function","z":"894c465c.5897a8","name":"Add attributes","func":"msg.topic = \"Test Picture for Mike\";\nmsg.description = \"This is some body text to go with the picture;\"\nmsg.filename = \"testpic.jpg\";\nreturn msg;","outputs":1,"noerr":0,"x":940,"y":300,"wires":[["3db8e9d3.a28286"]]},{"id":"3fa12b11.a1bac4","type":"exec","z":"894c465c.5897a8","command":"curl -m 10 --digest -u \"admin:XXX\" http://192.168.1.153/cgi-bin/video.cgi?msubmenu=jpg","addpay":false,"append":"","useSpawn":false,"timer":"","name":"","x":500,"y":300,"wires":[["3955c3d6.3a5e7c","810adcec.25da4"],[],[]]},{"id":"810adcec.25da4","type":"debug","z":"894c465c.5897a8","name":"","active":false,"console":"false","complete":"false","x":930,"y":240,"wires":[]}]

This seems to work fine. If there isn't a better way, i'll just use this.

Thanks for the massive help though!!

Julian Knight

unread,
Nov 29, 2016, 7:18:18 AM11/29/16
to Node-RED
Yes, well an .mjpeg file is a video - a Multimedia Motion JPEG, common on low cost security cams. https://en.wikipedia.org/wiki/Motion_JPEG

But that command is useful because it tells us exactly what is needed to get the video back. Though I recommend you keep the saved file with a .mjpeg extension.

Now we know that there is a way to do what you want though it would be clunky. That is to call curl from a Node-RED command node. Would be nicer if Nick can get it added to the node though ;-)
Reply all
Reply to author
Forward
0 new messages