mirror of
https://github.com/Googolplexed0/zotify.git
synced 2026-04-26 06:45:54 +03:00
[GH-ISSUE #20] Unable to authenticate docker container #17
Labels
No labels
bug
considering
discussion
documentation
enhancement
enhancement
good first issue
help wanted
pull-request
question
stale
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/zotify#17
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @IvanCarapovic on GitHub (Jun 9, 2025).
Original GitHub issue: https://github.com/Googolplexed0/zotify/issues/20
Hi,
I built the docker image locally and when I run it, it provides the link to authenticate against Spotify. However, how do I actually route back the auth code to the docker image? I tried running with network_mode: "host", but it seems that even at that point, there is nothing at 127.0.0.1:4381, at best I managed to get "connection reset" but I can't pass that point with docker. I do have an older version locally installed without docker which I managed to get to work, but it has been forever since I've set it up there...
@Googolplexed0 commented on GitHub (Jun 9, 2025):
Duplicate of #17, update the library past commit
b3ed323041and change the REDIRECT_URI value. I do not know what value will work for Docker, as I have negligible experience with the ecosystem. Please let me know your findings so I can add them to the README Docker advice section for future users.@wchorski commented on GitHub (Aug 8, 2025):
first I had to open the port with the docker run command with
-p "4381:4381"Changing
REDIRECT_ADDRESSto my server's hostname or IP caused an invalid link. I just had to manually change127.0.0.1to my server's hostname/IP (in browser's address bar) after clicking spotify auth link.Git dependency
I also had to add the git dependancy to the Dockerfile at line
RUN apk --update add ffmpeg gitfor it to build without errors@Googolplexed0 commented on GitHub (Aug 8, 2025):
This is mentioned in the README under the Docker subsection.
Fixed with
046a037.This is very strange. Is this an issue with the current implementation of OAuth?
@redlegoman commented on GitHub (Dec 3, 2025):
In order to allow port 4381 to be contacted from outside the docker container, an address of 0.0.0.0 needs to be specified, otherwise port 4381 is only connectable from inside the container and connections from outside are refused. Using 0.0.0.0 means "allow any connections".
But, then the URI printed to screen has "0.0.0.0" and this needs to be configurable as 127.0.0.1 or 192.168.1.10 or whatever the correct IP address is for the docker host machine is.
E.G. if the machine on which you are running docker has an ip address of 192.168.2.200, then the URL needs to have 192.168.2.200:4381 in the URI to be pasted/copied while the web server in the python config.py needs to still listen for connections from 0.0.0.0, not 192.168.2.200
Hope that makes sense
I'm no python expert, so I can't work out if librespot-oauth allows you to set a different listen address, different to the actual return_uri, that's what's needed really. Otherwise you need to do as @wchorski says above and change the "0.0.0.0" to the right address when copying and pasting.
@redlegoman commented on GitHub (Dec 3, 2025):
after further investigation, it is librespot-python that needs a tweak. it runs up an http.server and always uses the hostname from the redirect_url. It will need an extra parameter to allow it to listen on 0.0.0.0 and use a different redirect_url. I have made these changes in my own fork of librespot-python and added and extra "--listen-address" param to zotify, but I don't really want to maintain a fork of librespot-python
my changes to librespot are here
Also, I don't know if any of the changes I've made (I really only have a slim grasp on python and what I'm doing here) will break zotify/librespot-python when running outside docker
FWIW, here are the changes I made to zotify: