OctoPrint/OctoPrint

[Request] Add support for HTTP Basic Auth credentials to Classic Webcam snapshot camera

Opened this issue · 3 comments

The problem

OctoPrint can't access snapshot URL from IP camera. Test shows "Snapshot test failed / Could not retrieve snapshot URL, please double check the URL". Stream works well.

Config:
Stream URL: http://user:password@X.X.X.X/mjpg/video.mjpg [accessible through browser]
Snapshot URL: http://user:password@X.X.X.X/jpg/1/image.jpg [accessible through browser]
image
'Validate SSL' option makes no difference.

Did the issue persist even in safe mode?

Yes, it did persist

If you could not test in safe mode, please state why ("currently printing" is NOT an excuse!)

No response

Version of OctoPrint

1.10.1

Operating system running OctoPrint

OctoPi* 1.0.0 (build 2024.04.25.094544)

Printer model & used firmware incl. version

No response

Browser and version of browser, operating system running browser

Chrome/Firefox

Checklist of files to include below

  • Systeminfo Bundle (always include!)
  • Contents of the JavaScript browser console (always include in cases of issues with the user interface)
  • Screenshots and/or videos showing the problem (always include in case of issues with the user interface)
  • GCODE file with which to reproduce (always include in case of issues with GCODE analysis or printing behaviour)

Additional information & file uploads

No response

You haven't provided a system info bundle, which includes logs which are really crucial here. But based on the URLs you shared, I'm going to assume the problem here is that your username@password syntax simply is deprecated and not supported by the underlying Python library used for fetching the snapshot. Tbh, I'm kinda surprised the Stream URL works in your browser in 2024.

See also the corresponding section in RFC3986.

However, that means that we need some way to provide Basic Authentication credentials for the snapshot URL, so this just turned into a Feature Request.

I can't provide logs because my SD card died and I'm waiting for a new one (32GB). For some reason I can't use my 64/128GB cards because I'm having partitioning issue at the first boot.
Stream in OctoPrint was working well despite having the same basic authentication. Problem was only with the snapshots.
In Firefox I need to confirm login (You are about to log in to the site “X.X.X.X” with the username “user”.), Chrome just starts the stream/shows snapshot.

Basic, Digest and Bearer auth will be supported from 1.11.0 onward via new options in the Classic Webcam settings.

image

Additionally, if you configure a snapshot URL with the deprecated in-URL credentials, OctoPrint will warn you about that and refer you to the advanced options containing the authentication settings.