Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Cam with basic-auth does not work #18

Open
micatec26 opened this issue Jul 28, 2022 · 7 comments
Open

Add Cam with basic-auth does not work #18

micatec26 opened this issue Jul 28, 2022 · 7 comments
Labels
question Further information is requested

Comments

@micatec26
Copy link

Describe the bug
Adding an IP-Cam which only accepts access to its streams after entering username and password (basic-auth) does not work for me.

To Reproduce

  1. one: Adding a cam which allows anonymous streaming clients in ioBroker.cameras worked fine (e. g. with an older Arecont-Vision cam)
    The object in ioBroker's object-browser is generated, OK.
    By click on it, I see the picture from the cam's stream, OK.

  2. one: Now adding a cam which already works in IO-Broker.vis with URL "http://username:password@192.168.123.123/jpg/1/image.jpg" in ioBroker.cameras:
    Selected on type: "URL with basic auth", specified the following URL: http://192.168.123.123/jpg/1/image.jpg and username as well as password in the given form fields.
    Then saved and restarted the adapter ioBroker.cameras.
    The object in ioBroker's object-browser is generated, OK.
    By click on it, the admin interface crashes.
    Tried to open the URL: https://192.168.123.123:8082/cameras.0/cam1
    Now the following message appears:
    connect ECONNREFUSED 127.0.0.1:8200

I am testing not on the local iobroker-machine. As local ip-address in ioBroker.cameras I tried 127.0.0.1 as well as ioBroker's internal IP.
By the way: If I click on "Prüfung", to check the connection to the camera, I always get an error "timeout". This also happens with the usually working Arecont-Camera (see 1. above).

Including username:password@... like in the URL above and selecting "URL" instead of "URL with basic auth" also did not work.

And finally here's ioBroker's log entry for the not-working cam:

Cannot get camera image of cam1: Error: <title>401 Unauthorized</title>

Unauthorized

This server could not verify that youare authorized to access the documentrequested. Either you supplied the wrongcredentials (e.g., bad password), or yourbrowser doesn't understand how to supplythe credentials required.

Screenshots & Logfiles
grafik
grafik
grafik

Versions:

  • Adapter version: 0.1.8
  • JS-Controller version: 4.0.23
  • Node version: 16.16.0
  • Operating system: Ubuntu Linux 20.04.4 LTS
  • ioBroker.vis: 1.4.15

Additional context
On instance ioBroker.vis, SSL with self-signed certificates is activated. Users have to login at the vis-interface at port 8082 and 8081 (admin)

Please let me know if I could test something!

Best regards and thanks for your great work,
micatec

@Apollon77
Copy link
Collaborator

How you normally access the camera via browser? Does it work with username/pssword in URL? Thre are some cameras that use digest Auth instead of Basic Auth ... maybe your camera is working like that ...

@micatec26
Copy link
Author

Usually I access the cam with an URL like http://username:password@ipaddressofcam/.../....jpg for example.
This URL I can access via any webbrowser. But I also tried it at the camera-settings of iobroker.cameras. Same result as above: timeout and no camera picture

I tried AXIS P1425-LE, AXIS P3225-LVE MKII as well as Mobotix M12.

@bertl83
Copy link

bertl83 commented Jan 26, 2023

I ve the same Problem with the "connect ECONNREFUSED 127.0.0.1:80" message

@Apollon77
Copy link
Collaborator

Why he tries to use localhost port 80 in your case? This most likely will not work

@bertl83
Copy link

bertl83 commented Jan 27, 2023

Why he tries to use localhost port 80 in your case? This most likely will not work

I dont know. I ve installed the newest version. The Instance/Adapter dosnt create any DPs... Iv i klick in the cam config on the web link i become the econn err and if i klick on the local link i get the invalid key message. Dont know why because if i klick the test button i see my cam pic without any error.

@bertl83
Copy link

bertl83 commented Jan 27, 2023

Why he tries to use localhost port 80 in your case? This most likely will not work

I ve set the Log to all. If i klick on the Lokal link the Instance crash:

cameras.0 2023-01-27 06:14:16.250 warn Terminated (UNCAUGHT_EXCEPTION): Without reason
cameras.0 2023-01-27 06:14:16.249 debug Plugin sentry destroyed
cameras.0 2023-01-27 06:14:16.246 info terminating
cameras.0 2023-01-27 06:14:15.721 error Exception-Code: ERR_HTTP_HEADERS_SENT: Cannot set headers after they are sent to the client
cameras.0 2023-01-27 06:14:15.720 error Error: Cannot set headers after they are sent to the client at new NodeError (node:internal/errors:387:5) at ServerResponse.setHeader (node:_http_outgoing:644:11) at /opt/iobroker/node_modules/iobroker.cameras/main.js:357:41
cameras.0 2023-01-27 06:14:15.715 error unhandled promise rejection: Cannot set headers after they are sent to the client
cameras.0 2023-01-27 06:14:15.714 error Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch().
cameras.0 2023-01-27 06:14:14.389 debug Request cam1 urlBasicAuth http://192.168.2.15/Streaming/channels/1/Picture
cameras.0 2023-01-27 06:13:27.588 debug Server started on 192.168.2.49:8200
cameras.0 2023-01-27 06:13:25.610 debug Request urlBasicAuth http://192.168.2.31/Streaming/channels/15/Picture cam2
cameras.0 2023-01-27 06:13:25.565 debug Request urlBasicAuth http://192.168.2.15/Streaming/channels/1/Picture cam1
cameras.0 2023-01-27 06:13:24.694 info starting. Version 1.0.3 (non-npm: ioBroker/ioBroker.cameras) in /opt/iobroker/node_modules/iobroker.cameras, node: v16.19.0, js-controller: 4.0.24

@GermanBluefox
Copy link
Contributor

Please retest with newest version

@GermanBluefox GermanBluefox added the question Further information is requested label Mar 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants