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

**URL:** <https://discourse.nodered.org/t/chrome-can-view-annke-c800-ip-camera-image-but-http-request-gets-401-response/57156>\
**Category:** General\
**Tags:** http-request\
**Created:** [24 January 2022 17:35 UTC](https://discourse.nodered.org/t/chrome-can-view-annke-c800-ip-camera-image-but-http-request-gets-401-response/57156 "2022-01-24T17:35:07Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 January 2022 08:19 UTC](https://discourse.nodered.org/t/chrome-can-view-annke-c800-ip-camera-image-but-http-request-gets-401-response/57156/22 "2022-01-26T08:19:30Z")

</div>

Hmmm, if it fails in cURL - its a tough one

could you retry the whole process but access the image via HTTPS `https://admin:XXXXXX@192.168.1.210/ISAPI/Stream......` in the browser. If that works, then copy the curl and try again?

If that doesnt work, my last idea will be to try as a `copy node fetch` and try in a function node

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [26 January 2022 09:03 UTC](https://discourse.nodered.org/t/chrome-can-view-annke-c800-ip-camera-image-but-http-request-gets-401-response/57156/23 "2022-01-26T09:03:26Z")

</div>

When you login look in the network tab, are you sure it is not utilizing an intermediary page that redirects it further ? (ie, with a 302/304 where some session/cookie is being stored ?).

side note about the topic title; if you open an incognito tab with the url, I do not believe the url will load if the curl gives you unauthorized.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 January 2022 10:17 UTC](https://discourse.nodered.org/t/chrome-can-view-annke-c800-ip-camera-image-but-http-request-gets-401-response/57156/24 "2022-01-26T10:17:23Z")

</div>

thats where my thinking was due to ...

> [@nygma2004](#):
>
> `-H 'Upgrade-Insecure-Requests: 1' \`

@nygma2004 could you tick `[x] preserve log` and refresh.

Also, could you show use the preview and response tabs?

---

<div class="post-metadata">

**Author:** ![nygma2004](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nygma2004/32/1308_2.png) [@nygma2004](https://discourse.nodered.org/u/nygma2004)\
**Post date:** [26 January 2022 10:52 UTC](https://discourse.nodered.org/t/chrome-can-view-annke-c800-ip-camera-image-but-http-request-gets-401-response/57156/25 "2022-01-26T10:52:34Z")

</div>

> [@Steve-Mcl](#):
>
> @nygma2004 could you tick `[x] preserve log` and refresh.  
> Also, could you show use the preview and response tabs?

It looks like this after refresh:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/a/2abc91c48da669ccf4987b98a15ce8ab094d1973.jpeg)

And nothing on the response tab:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/8/78f9abc086201e58db4123e8e3c7594e72709e35.jpeg)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 January 2022 11:01 UTC](https://discourse.nodered.org/t/chrome-can-view-annke-c800-ip-camera-image-but-http-request-gets-401-response/57156/26 "2022-01-26T11:01:26Z")

</div>

Ok, last one from me.

1. Did you try https in the browser URL?

> [@Steve-Mcl](#):
>
> could you retry the whole process but access the image via HTTPS `https://admin:XXXXXX@192.168.1.210/ISAPI/Stream......` in the browser. If that works, then copy the curl and try again?

1. Try the CURL again but remove `- H 'Upgrade-Insecure-Requests: 1' \` line

2. Try the curl again by add `image/jpeg` to the accept header e.g. `-H 'Accept: text/html,image/jpeg,application/xhtml......`

---

<div class="post-metadata">

**Author:** ![nygma2004](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nygma2004/32/1308_2.png) [@nygma2004](https://discourse.nodered.org/u/nygma2004)\
**Post date:** [26 January 2022 11:09 UTC](https://discourse.nodered.org/t/chrome-can-view-annke-c800-ip-camera-image-but-http-request-gets-401-response/57156/27 "2022-01-26T11:09:41Z")

</div>

I tried enabling the HTTPS access and the admin page runs on HTTPS, but the direct image link does not.

I also tried with the two options you suggested and I get the same 401 response back.

I will try to ask around in the Annke forum as well. I will update this thread if I find something out.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 January 2022 11:13 UTC](https://discourse.nodered.org/t/chrome-can-view-annke-c800-ip-camera-image-but-http-request-gets-401-response/57156/28 "2022-01-26T11:13:28Z")

</div>

I think that's the way you'll have to go.

I updated the title to focus attention to anyone familiar with this camera or issue.

---

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [26 January 2022 12:18 UTC](https://discourse.nodered.org/t/chrome-can-view-annke-c800-ip-camera-image-but-http-request-gets-401-response/57156/29 "2022-01-26T12:18:32Z")

</div>

> [@nygma2004](#):
>
> 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.

Since the above method also works .. can you show us the request made in browser when you first visit  
`http://192.168.1.210/ISAPI/Streaming/channels/1/picture`  
and the request and headers after you are presented with the Chrome logon window and you fill in your credentials ?

* * *

**[EDIT]**  
after further reading of how Basic authorization is done .. can you try  
using this code in a Function node before your GET **http-request** to  
`http://192.168.1.210/ISAPI/Streaming/channels/1/picture`

(add the rest of the headers as shown in your first post)

```auto
var username = 'user';
var password = 'password';
var basicAuth = 'Basic ' + Buffer.from(`${username}:${password}`).toString('base64') ;

msg.headers = { 'Authorization': basicAuth }

return msg;

```

---

<div class="post-metadata">

**Author:** ![nygma2004](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nygma2004/32/1308_2.png) [@nygma2004](https://discourse.nodered.org/u/nygma2004)\
**Post date:** [26 January 2022 19:28 UTC](https://discourse.nodered.org/t/chrome-can-view-annke-c800-ip-camera-image-but-http-request-gets-401-response/57156/30 "2022-01-26T19:28:55Z")

</div>

OK for some reason the login pop-up is does not appear from Chrome now, maybe I should restart my computer. But it happens from Edge:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/7/b72d24c8216b3037e85f568bc692873f231fc6a0.png)

Now I can see a digest authentication in the header.

I also tried your example for passing the basic authentication and it did not help. Still getting error 401.

The topic on the Annke forum is open now, will monitor what response I get.

---

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [26 January 2022 19:39 UTC](https://discourse.nodered.org/t/chrome-can-view-annke-c800-ip-camera-image-but-http-request-gets-401-response/57156/31 "2022-01-26T19:39:26Z")

</div>

> [@nygma2004](#):
>
> maybe I should restart my computer

not a restart but maybe clearing the browser cache and any cookies for that page

> [@nygma2004](#):
>
> digest authentication in the header.

thats important information .. so its not Basic authentication .. which is why my code example is not working

Have you tried using Digest auth. with your credentials ?

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/e/2e10299c8cd4882450441dad21522e470aa372e8.png)

OR (seperate test)

with the `Use authentication` unchecked replicate whatever new headers you see in Chrome with the use of Function node ? especially that Authorization header

---

<div class="post-metadata">

**Author:** ![nygma2004](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nygma2004/32/1308_2.png) [@nygma2004](https://discourse.nodered.org/u/nygma2004)\
**Post date:** [26 January 2022 20:02 UTC](https://discourse.nodered.org/t/chrome-can-view-annke-c800-ip-camera-image-but-http-request-gets-401-response/57156/32 "2022-01-26T20:02:40Z")

</div>

Believe it or not, it does f... all. This is how I set it up. I tried with both inject node, one goes straight to http-request and the other via the function node to add the header (not the basic authentication, just the rest like user agent, etc.). And the response is the same in both cases:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/5/3529acefd23d3d288f71f30ffcf05aad7d2bfd7c.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 January 2022 20:25 UTC](https://discourse.nodered.org/t/chrome-can-view-annke-c800-ip-camera-image-but-http-request-gets-401-response/57156/33 "2022-01-26T20:25:22Z")

</div>

This is like a mission now 😂😂

Would you be willing to make your camera available over the internet & I'll give it go?

Don't worry, getting access using the node-red-contrib-ngrok node is quite simple (and safe)

If yes, then DM me on here with details.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 January 2022 21:45 UTC](https://discourse.nodered.org/t/chrome-can-view-annke-c800-ip-camera-image-but-http-request-gets-401-response/57156/34 "2022-01-26T21:45:58Z")

</div>

Sorry if this upsets you but...

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/3/93ac1027f4ccfa6d394b27b9add5710705c4c3fb.png)

↑ first attempt ( 😂 )

Try this flow (the URL and credentials were sanitised - they will need to be re-populated)...

```auto
[{"id":"5b278c8a8cf6ba6a","type":"http request","z":"950e6f56f9415563","name":"","method":"GET","ret":"bin","paytoqs":"ignore","url":"http://xxxxx.ddns.net:1240/ISAPI/Streaming/channels/1/picture","tls":"","persist":false,"proxy":"","authType":"digest","senderr":false,"x":960,"y":840,"wires":[["9b8400c7928d5f04","858d8023dd7b8a69"]]},{"id":"e28fbb96d41569de","type":"function","z":"950e6f56f9415563","name":"add headers","func":"msg.headers = {\n \"Accept\": \"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9\",\n \"Accept-Encoding\": \"gzip, deflate\",\n \"Accept-Language\": \"en-GB,en;q=0.9,en-US;q=0.8\",\n \"Cache-Control\": \"no-cache\",\n \"Connection\": \"keep-alive\",\n \"Host\": \"xxxxx.ddns.net:1240\",\n \"Pragma\": \"no-cache\",\n \"Upgrade-Insecure-Requests\": \"1\",\n \"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 Edg/97.0.1072.69\",\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":790,"y":840,"wires":[["5b278c8a8cf6ba6a"]]},{"id":"da3a017095ace603","type":"inject","z":"950e6f56f9415563","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{}","payloadType":"json","x":630,"y":840,"wires":[["e28fbb96d41569de"]]},{"id":"858d8023dd7b8a69","type":"debug","z":"950e6f56f9415563","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1150,"y":800,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [26 January 2022 22:04 UTC](https://discourse.nodered.org/t/chrome-can-view-annke-c800-ip-camera-image-but-http-request-gets-401-response/57156/35 "2022-01-26T22:04:32Z")

</div>

Nice one 😉

so what was the problem ?  
the missing Host header and the type of authentication to be set to Digest?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 January 2022 22:16 UTC](https://discourse.nodered.org/t/chrome-can-view-annke-c800-ip-camera-image-but-http-request-gets-401-response/57156/36 "2022-01-26T22:16:22Z")

</div>

Unsure. It worked by simply copying the headers and setting digest auth - so i didnt look any further until @nygma2004 responds & confirms - there may still be an issue - at which time we should ask what node/node-red versions, os etc.

---

<div class="post-metadata">

**Author:** ![nygma2004](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nygma2004/32/1308_2.png) [@nygma2004](https://discourse.nodered.org/u/nygma2004)\
**Post date:** [26 January 2022 22:42 UTC](https://discourse.nodered.org/t/chrome-can-view-annke-c800-ip-camera-image-but-http-request-gets-401-response/57156/37 "2022-01-26T22:42:18Z")

</div>

Hmmmmmm:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/4/549abe3cde5dfa4dcc41aacc44af9ca05a372b88.png)

And using the second inject node:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/5/55e499efb35cc9a34e98acd48e7bfef3d7a956d4.png)

I am truly clueless. The only thing I have done before I dropped the email to you is changed the password. But I have re-typed the password multiple times in the past few days. And I was using a password that I use for a long time and it is unlikely that I have consistently mistyped it. But that is the only thing I can think of. So it even works without the headers. I really have no idea what changed.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [26 January 2022 22:46 UTC](https://discourse.nodered.org/t/chrome-can-view-annke-c800-ip-camera-image-but-http-request-gets-401-response/57156/38 "2022-01-26T22:46:53Z")

</div>

> So it even works without the headers.

I highly doubt it. It "currently" works because you have an authenticated session.

---

<div class="post-metadata">

**Author:** ![nygma2004](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nygma2004/32/1308_2.png) [@nygma2004](https://discourse.nodered.org/u/nygma2004)\
**Post date:** [26 January 2022 23:04 UTC](https://discourse.nodered.org/t/chrome-can-view-annke-c800-ip-camera-image-but-http-request-gets-401-response/57156/39 "2022-01-26T23:04:02Z")

</div>

> [@bakman2](#):
>
> I highly doubt it. It "currently" works because you have an authenticated session.

Yes, I realized it works most probably because the first inject node worked. So could be a lucky mix of headers.  
I will restart the server and try again with the old and new code.

---

<div class="post-metadata">

**Author:** ![nygma2004](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nygma2004/32/1308_2.png) [@nygma2004](https://discourse.nodered.org/u/nygma2004)\
**Post date:** [27 January 2022 09:06 UTC](https://discourse.nodered.org/t/chrome-can-view-annke-c800-ip-camera-image-but-http-request-gets-401-response/57156/40 "2022-01-27T09:06:44Z")

</div>

I just had a short power outage, so the server got restarted. And everything is working, with or without the header fields.

Therefore I think the solution was to add the userid and password as "digest authentication" in the "use authentication" section. And also don't forget to change the output to binary buffer if you send the image to file, image preview node.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/d/9d46586cc025d64f5a249db40939672339926cf0.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [27 January 2022 10:56 UTC](https://discourse.nodered.org/t/chrome-can-view-annke-c800-ip-camera-image-but-http-request-gets-401-response/57156/41 "2022-01-27T10:56:46Z")

</div>

Good stuff. Please mark the post that feel is the solution.

[Previous page](https://discourse.nodered.org/t/chrome-can-view-annke-c800-ip-camera-image-but-http-request-gets-401-response/57156.md?page=1)

[Next page](https://discourse.nodered.org/t/chrome-can-view-annke-c800-ip-camera-image-but-http-request-gets-401-response/57156.md?page=3)
