musikcube icon indicating copy to clipboard operation
musikcube copied to clipboard

Playback from VLC using HTTP basic authentication failing

Open pcgeek86 opened this issue 2 years ago • 6 comments

  • Set a password for musikcube, under Server Setup
  • Trying to connect VLC to musikcube port 7906 using HTTP basic authentication
  • The following message keeps repeating in the VLC console
[000002537814b6e0] access stream error: HTTP 401 error                                                                  
[000002537814b6e0] http stream error: authentication failed without realm                                               
[000002537814b860] access stream error: HTTP 401 error                                                                  
[000002537814b860] http stream error: authentication failed without realm                                               
[000002537814b860] access stream error: HTTP 401 error                                                                                                                                            

Any ideas on how to work around this?

pcgeek86 avatar May 08 '22 20:05 pcgeek86

Seeing the same issue with a fresh dev build, both using VLC as well as manually making GET requests to it. Would be nice to see it looked into.

iiPythonx avatar Jan 25 '23 22:01 iiPythonx

Out of curiosity, how are you obtaining track URLs for playback within VLC? And how are you setting the auth header? I don't see any options for that in the VLC UI. If you can give me more details I can try to repro on my end.

You can also set the environment variable MUSIKCUBE_DISABLE_HTTP_SERVER_AUTH=1 to disable HTTP auth if you wish.

clangen avatar Jan 26 '23 02:01 clangen

I just now realized the title of this issue is about playback; I was using VLC to load album art from musikcube.

Regardless, when it comes to the HTTP Basic Auth: no matter what password I send to musikcube, it always returns a 401 Unauthorized. I'm using Python for my tests and can confirm it is sending the header correctly:

from requests import get
print(requests.get("http://localhost:7905/thumbnail/id", auth = ("default", "")))
# returns 'unauthorized' despite having no password set
# doing the same code but using a password yeilds no difference

Yes, the server had no password set. This also occurs if I set the password to something as simple as 'abc'. I just cannot get http auth to work.

Edit: currently on mobile, will continue testing tomorrow on PC

iiPythonx avatar Jan 26 '23 05:01 iiPythonx

Hmm, this seems to work for me:

> python3
Python 3.10.7 (main, Nov 24 2022, 19:45:47) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from requests import get
>>> print(get("http://192.168.1.221:7906/thumbnail/908", auth = ("default", "776655")))
<Response [200]>

One thing to note is that your sample is using port 7905, but this is the websocket server. The HTTP server runs on port 7906 -- perhaps this is your issue?

clangen avatar Jan 26 '23 06:01 clangen

I'm using port 7906 for thumbnails, I guess I put a typo in my example. Yesterday I was always getting a 401, today it seems to give me a "Remote end closed connection" when I actually get the password right now. image

Assuming that Musikcube returns a 404 on an unexisting thumbnail?

iiPythonx avatar Jan 26 '23 14:01 iiPythonx

Nevermind, Musikcube closes the connection for thumbnails that don't exist. I was expecting a 404.

iiPythonx avatar Jan 26 '23 14:01 iiPythonx