Chrome can view Annke C800 IP camera image but HTTP Request gets 401 response

Hi Guys,

This issue is with an Annke C800 IP camera. I am trying to access the still image using the HTTP URL. I tested this URL in Chrome, and also in Edge and it returns the still image: http://admin:password@192.168.1.210:80/ISAPI/Streaming/channels/1/picture

And when I do the same in NR, I get a 401 Unauthorized. (No I am not logged into the admin site in a different Chrome window.)

I tried pasting in the link as below:

I also tried to tick "Use Authentication" and pass the userid and password that way, but no change.

Next I checked the Request Headers in Chrome and added all of them in a function node before the HTTP request:

Still no change. How could I "debug" this further? What else can I try? I actually talked to Annke but they obviously say that since it works in a browser, the issue must be Node-Red.

Any ideas?

Have a look in the network tab in developer tools on the browser. Do you see any other headers or cookies in the request when you refresh the page?

I assume you have logged in on the browser some point and your credentials are cached.

If that doesn't work you might want to try the onvif nodes (assuming your camera support onvif).

No Cookies as far as I can see:

And this is how the header looks like:

I thought it might catch the login details, but it works from Edge as well that I never used to log into the admin site.
Onvif would be a good option, but for this particular camera the get image function crashes the entire Node-Red. I have a thread open on that, but I don't expect quick resolution of that issue.

You might need to send that request header data through a function node into your http request node. I’ll try to post you an example in a bit.

I'm not sure Onvif would help, as that URL looks a lot like the URL for an Onvif "snapshot"

Two of my "onvif" cameras snapshot URLs:
http://admin:admin@192.168.2.61:80/tmpfs/auto.jpg
http://192.168.2.53/webcapture.jpgcommand=snap&channel=1&user=admin&password=tlJwpbo6

Also read this thread from the Annke forum .. worth to also try the url mentioned there

http://admin:abcd1234@192.168.1.210/ISAPI/Streaming/channels/102/httpPreview

Yes I did that. If you check my first screenshots, I did have a function node with header data populated, but that did not help either.

Yes, I have seen this topic. The link with the httpPreview at the end if a streaming video link for the sub stream. And that is behaving the same, works from Chrome, but gives 401 Unauthorized from Node-Red.

The link works fine in Chrome and gives me the still image. And for this camera this is the documented official link.

1 Like

Silly question but when you tried the Use Authentication option i imagine you used Basic Authentication and you removed the admin:pass@ from the url ?

Yes, I tried. Both with the u/p in the URL and also removed from the URL and added to the "Use authentication" section with "basic authentication".

If I put the plain URL into Chrome (without the user and password), I get the Chrome logon window, but after entering the u/p I get the image. So the user authentication works. There must be some stupid cookie or header issue, but I can't see what it can be.

If you copy the curl request (via network tab) and paste it in a terminal, does it work?

No, it is the same, I get 401 here as well:

Did you copy the curl from developer tools network tab or build it yourself?

I have taken the Request URL from developer tools and typed curl and pasted that URL in. I hope this is what you meant:

No. Right click the entry in the network requests list (far left where it says "picture") -> copy -> as curl

It will include all the headers and settings etc

Try that

If it works, copy & paste the exact curl here (xxx the password)

1 Like

In addtion I would recommend, logout the cam, clear the cache/details, login and without doing anything else, copy the request from the main index/html page:

Ah OK, got it now. Cache cleared, I copy the cURL from the developer mode and I got this in the terminal:

nygma@NodeRedServer:~$ curl "http://admin:XXXXX^@192.168.1.210/ISAPI/Streaming/channels/1/picture" ^
  -H "Connection: keep-alive" ^
  -H "Upgrade-Insecure-Requests: 1" ^
  -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36" ^
  -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" ^
  -H "Accept-Language: en-GB,en;q=0.9,en-US;q=0.8,hu;q=0.7" ^
  --compressed ^
  --insecure
<!DOCTYPE html>
<html><head><title>Document Error: Unauthorized</title></head>
<body><h2>Access Error: 401 -- Unauthorized</h2>
<p>Authentication Error</p>
</body>
</html>
curl: (6) Could not resolve host: ^
-bash: -H: command not found
-bash: -H: command not found
-bash: -H: command not found
-bash: -H: command not found
-bash: -H: command not found
-bash: --compressed: command not found
-bash: --insecure: command not found

Looks like you did not copy as bash (should be \ line continuations not ^

image

Are you using chrome?

Yes, I use Chrome. The result is very similar:

nygma@NodeRedServer:~$ curl 'http://admin:XXXXXX@192.168.1.210/ISAPI/Streaming/channels/1/picture' \
  -H 'Connection: keep-alive' \
  -H 'Cache-Control: max-age=0' \
  -H 'Upgrade-Insecure-Requests: 1' \
  -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36' \
  -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \
  -H 'Accept-Language: en-GB,en;q=0.9,en-US;q=0.8,hu;q=0.7' \
  --compressed \
  --insecure
<!DOCTYPE html>
<html><head><title>Document Error: Unauthorized</title></head>
<body><h2>Access Error: 401 -- Unauthorized</h2>
<p>Authentication Error</p>
</body>
</html>
nygma@NodeRedServer:~$