HTTP Binding digest authentication

Hey guys,

i’m trying to do some DAHUA Camera API requests. I want to change the Camera Profile.

this is just for documentation/Information. I will set this in a blockquote:

OFFTOPIC just for documentation

The “Clean” Syntax was:
http://user:pw@IP/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=1

which brings me to:
http://*XXXXXX*@192.168.1.219/cgi-bin/configManager.cgi?action=setConfig%%26VideoInMode%[0%].Config%[0%]=1
or
http://192.168.1.219/cgi-bin/configManager.cgi?action=setConfig%%26VideoInMode%[0%].Config%[0%]=1{Authorization=Basic%%20YWRtaW46SDhBUlRjMG0=}

You see. I did much of Research and trying to get this and i think this should be the right url to post to.
I Always wondered why the camera asks for User/PW when requesting unsing browser even if it added the Basic Auth at the beginning. After many more Hours of searching i came across that DAHUA removed Basic Auth from their products usind DIGEST only in the later product/Firmware range.

So my Question is:
Is it possible to do HTTP Requests using DIGEST authentication?
Is there a possible Workaround?

I’m running openHAB on a SYNOLOGY Rackstation.

Posting username and passwords via url is not supported anymore (different browsers deal with it differently). Please have a look at the http binding (https://www.openhab.org/addons/bindings/http1/)

At the bottum it is explained how to deal with basic authentication

http="<[http://sample.com{Authorization=Basic dXNlcm5hbWU6cGFzc3dvcmQ=}]"

You will probably have to build the HTTP request yourself. You can see examples of this in

Or use curl and the Exec binding or executeCommandLine.

as i tried to explain i know. but dahua doesn’t support Basic Auth any more. only DIGEST

Thanks! I will have a look at oauth2 example. I think that should work

Hi, I have a similar challenge where I need to use digest authentication to obtain data from my camera.
I order the get a snapshot image from the camera upon an event (door bell pressed) and send the JPEG image via pushover to my phone I wrote a rule and used curl with --digest via executeCommandLine. This part works really good.
However I’m pretty lost when it comes to the mjpeg stream. I just cannot figure out how to use a similar curl command and embed the live stream in the sitemap. Any suggestion with some more or less specific example would be very much appreciated.

I don’t think you can do it. If you need the digest information to access the MJPEG stream than there is no way to supply the digest in the Video tag on your sitemap. That’s why the OP had to resort to using curl or Rules.

Thank you for the quick reply.

Do you have any idea how the problem with the digest authentication and the embedded live stream could be solved? I had a quick look at the two links you mentioned above but unfortunately I couldn’t find any hint for my problem.

No. There is no way to supply the digest authentication that I know of in the URL you put on the sitemap. If you can’t include it in the URL, it cannot be done.

OK, I see.

I also briefly thought about redirecting or passing through the live stream to a port on localhost - something like the following but of course it does not work since TCP cannot be redirected in such an easy way :frowning:

curl --digest --user user:password -X GET http://ip_cam_addr/ISAPI/Streaming/Channels/101/httppreview > http://localhost:some_free_port

However, if the stream would be available via the localhost it could be easily included in the sitemap and the digest authentication would be handled by curl beforehand. But since I’m not a linux expert I’m not sure if this is doable at all.

Anyway, thank you for clarifying the situation with regards to openHAB.