[GH-ISSUE #17] Docker Oauth Flow #15

Closed
opened 2026-02-27 04:57:07 +03:00 by kerem · 6 comments
Owner

Originally created by @tannerhallman on GitHub (Jun 6, 2025).
Original GitHub issue: https://github.com/Googolplexed0/zotify/issues/17

Running the stack with docker causes the 127.0.0.1 redirect URL to not work. I think localhost would work instead, but I don't see how to update that on the code in main.

I see the redirect URI in this commit github.com/Googolplexed0/zotify@bacdfce322 (diff-81323b78bf)

but not when I pull it locally. Is that a dependency that we don't have access to edit? I'm not the most familiar with python. Thanks.

docker run -p 4381:4381 --rm -v "$PWD/Zotify Music:/root/Music/Zotify Music" -v "$PWD/Zotify Podcasts:/root/Music/Zotify Podcasts" -it zotify
Originally created by @tannerhallman on GitHub (Jun 6, 2025). Original GitHub issue: https://github.com/Googolplexed0/zotify/issues/17 Running the stack with docker causes the 127.0.0.1 redirect URL to not work. I think `localhost` would work instead, but I don't see how to update that on the code in main. I see the redirect URI in this commit https://github.com/Googolplexed0/zotify/commit/bacdfce322fa8842b7ccf7411b467f64cf244e92#diff-81323b78bfb0dba32ddbfae8d02d0bd94863c326656586ffa5f25f9ebc4c8911R32 but not when I pull it locally. Is that a dependency that we don't have access to edit? I'm not the most familiar with python. Thanks. ``` docker run -p 4381:4381 --rm -v "$PWD/Zotify Music:/root/Music/Zotify Music" -v "$PWD/Zotify Podcasts:/root/Music/Zotify Podcasts" -it zotify ```
kerem closed this issue 2026-02-27 04:57:07 +03:00
Author
Owner

@Googolplexed0 commented on GitHub (Jun 7, 2025):

Added a config option with b3ed323 that should let you try different REDIRECT_URI values and figure out what works for Docker. Please let me know your findings so I can add them to the README Docker advice section. If different URIs aren't fixing it, more logs and error messages would be necessary to find a fix.

<!-- gh-comment-id:2951332878 --> @Googolplexed0 commented on GitHub (Jun 7, 2025): Added a config option with b3ed323 that should let you try different `REDIRECT_URI` values and figure out what works for Docker. Please let me know your findings so I can add them to the README Docker advice section. If different URIs aren't fixing it, more logs and error messages would be necessary to find a fix.
Author
Owner

@IvanCarapovic commented on GitHub (Jun 11, 2025):

I found the issue that prevents Docker from working. Based off of https://stackoverflow.com/a/52518929 you should not use 127.0.0.1 as the IP inside docker, because you "lock" the app to the containers internal loopback address. You should use 0.0.0.0 so it listens to all interfaces, including those that come from outside of the container as we need it to.

Also, you need to add EXPOSE 4381 to the second last line in your Dockerfile so that the port 4381 can get mapped from host network to the internal network.

Once I did those 2 changes, I managed to authenticate. Note that you also need to add -p 4381:4381 to your docker run command in README (or alternatively --network host) so that the internal/external ports are mapped.

After login it seems the program crashes, but hey, we got 1 step further :)

zotify-1  | Traceback (most recent call last):
zotify-1  |   File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
zotify-1  |     return _run_code(code, main_globals, None,
zotify-1  |   File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
zotify-1  |     exec(code, run_globals)
zotify-1  |   File "/app/zotify/__main__.py", line 119, in <module>
zotify-1  |     main()
zotify-1  |   File "/app/zotify/__main__.py", line 111, in main
zotify-1  |     args.func(args)
zotify-1  |   File "/app/zotify/app.py", line 350, in client
zotify-1  |     search_text = input('Enter search: ')
zotify-1  | EOFError: EOF when reading a line
zotify-1  | Enter search:
zotify-1 exited with code 1
<!-- gh-comment-id:2964345196 --> @IvanCarapovic commented on GitHub (Jun 11, 2025): I found the issue that prevents Docker from working. Based off of https://stackoverflow.com/a/52518929 you should not use `127.0.0.1` as the IP inside docker, because you "lock" the app to the containers internal loopback address. You should use `0.0.0.0` so it listens to all interfaces, including those that come from outside of the container as we need it to. Also, you need to add `EXPOSE 4381` to the second last line in your Dockerfile so that the port 4381 can get mapped from host network to the internal network. Once I did those 2 changes, I managed to authenticate. Note that you also need to add `-p 4381:4381` to your docker run command in README (or alternatively `--network host`) so that the internal/external ports are mapped. After login it seems the program crashes, but hey, we got 1 step further :) ``` zotify-1 | Traceback (most recent call last): zotify-1 | File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main zotify-1 | return _run_code(code, main_globals, None, zotify-1 | File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code zotify-1 | exec(code, run_globals) zotify-1 | File "/app/zotify/__main__.py", line 119, in <module> zotify-1 | main() zotify-1 | File "/app/zotify/__main__.py", line 111, in main zotify-1 | args.func(args) zotify-1 | File "/app/zotify/app.py", line 350, in client zotify-1 | search_text = input('Enter search: ') zotify-1 | EOFError: EOF when reading a line zotify-1 | Enter search: zotify-1 exited with code 1 ```
Author
Owner

@IvanCarapovic commented on GitHub (Jun 11, 2025):

Added PR with my changes https://github.com/Googolplexed0/zotify/pull/21

<!-- gh-comment-id:2964369848 --> @IvanCarapovic commented on GitHub (Jun 11, 2025): Added PR with my changes https://github.com/Googolplexed0/zotify/pull/21
Author
Owner

@Googolplexed0 commented on GitHub (Jun 11, 2025):

@IvanCarapovic thanks for the fix! Did you change the REDIRECT_URI at all, to match the "0.0.0.0:4381" you changed the server to? If so, it might make sense to coordinate the __run_server address with the config so that they always match.

<!-- gh-comment-id:2964423039 --> @Googolplexed0 commented on GitHub (Jun 11, 2025): @IvanCarapovic thanks for the fix! Did you change the `REDIRECT_URI` at all, to match the `"0.0.0.0:4381"` you changed the server to? If so, it might make sense to coordinate the `__run_server` address with the config so that they always match.
Author
Owner

@IvanCarapovic commented on GitHub (Jun 12, 2025):

@Googolplexed0 As I see it, the REDIRECT_URI is not that problematic, the network access to the container was blocked before, no matter which redirect URI you choose, it would fail...

As for the IP, I think it should stay as-is, as the server you start has the IP of whatever it gets assigned, the IP is irrelevant, only the port. Thats why 0.0.0.0 is used as it basically means "listen everywhere". On the other side, when you actually make a request, you need to know where it is supposed to go, and in this case, you need a valid address, and in most cases, you run it locally, and therefore 127.0.0.1 is probably the place where you will find your server running most of the time.

<!-- gh-comment-id:2965388534 --> @IvanCarapovic commented on GitHub (Jun 12, 2025): @Googolplexed0 As I see it, the REDIRECT_URI is not that problematic, the network access to the container was blocked before, no matter which redirect URI you choose, it would fail... As for the IP, I think it should stay as-is, as the server you start has the IP of whatever it gets assigned, the IP is irrelevant, only the port. Thats why 0.0.0.0 is used as it basically means "listen everywhere". On the other side, when you actually make a request, you need to know where it is supposed to go, and in this case, you need a valid address, and in most cases, you run it locally, and therefore 127.0.0.1 is probably the place where you will find your server running most of the time.
Author
Owner

@Googolplexed0 commented on GitHub (Jun 12, 2025):

As for the IP, I think it should stay as-is, as the server you start has the IP of whatever it gets assigned, the IP is irrelevant, only the port. Thats why 0.0.0.0 is used as it basically means "listen everywhere". On the other side, when you actually make a request, you need to know where it is supposed to go, and in this case, you need a valid address, and in most cases, you run it locally, and therefore 127.0.0.1 is probably the place where you will find your server running most of the time.

Gotcha. After thinking about it for a few hours and running some tests, I came to roughly the same conclusion. Settled on making them both accessible (but keeping the defaults as they are now) with 2d97b8b. Excited to help troubleshoot our way through the rest of the Docker crashes. Might want to make a new issue since the OAuth is working, seems the issue is the input() function now.

<!-- gh-comment-id:2965487860 --> @Googolplexed0 commented on GitHub (Jun 12, 2025): > As for the IP, I think it should stay as-is, as the server you start has the IP of whatever it gets assigned, the IP is irrelevant, only the port. Thats why 0.0.0.0 is used as it basically means "listen everywhere". On the other side, when you actually make a request, you need to know where it is supposed to go, and in this case, you need a valid address, and in most cases, you run it locally, and therefore 127.0.0.1 is probably the place where you will find your server running most of the time. Gotcha. After thinking about it for a few hours and running some tests, I came to roughly the same conclusion. Settled on making them both accessible (but keeping the defaults as they are now) with 2d97b8b. Excited to help troubleshoot our way through the rest of the Docker crashes. Might want to make a new issue since the OAuth is working, seems the issue is the `input()` function now.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/zotify#15
No description provided.