mirror of
https://github.com/Rigellute/spotify-tui.git
synced 2026-04-26 08:05:57 +03:00
[GH-ISSUE #136] How to connect on spotify on a headless machine #75
Labels
No labels
bug
enhancement
good first issue
help wanted
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotify-tui#75
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 @eminence on GitHub (Nov 5, 2019).
Original GitHub issue: https://github.com/Rigellute/spotify-tui/issues/136
I'm running spotify-tui on a headless machine, and I'm having some troubles connecting spt to spotify. I did this successfully on an earlier version of spt, but I cannot get it working now.
On my Windows machine (which is the only machine with a browser), created a new app, and I've got access to my client ID and client secret.
When I launch spt on my remote linux machine, I get the instructions about how to create a new app, though I've already done this. So I enter in my Client ID and my Client Secret.
Next, spt opens an elinks browser to
https://accounts.spotify.com/login?continue=https://accounts.spotify.com/authorize?scope=...(I've elided the full URL here). The rendered page in elinks is blank, likely because javascript is required to display the login form. When I press q to quit elinks, spt says this in the terminal:Now it just hangs here doing nothing (presumably waiting for my local browser to make the request to the localhost callback.
So now I seem stuck and unsure what to do next.
Thanks for the help!
@Rigellute commented on GitHub (Nov 5, 2019):
Sorry to hear this! I think I get it.
This sounds like a problem predicted by @jfaltis when implementing auto handling redirect URL https://github.com/Rigellute/spotify-tui/pull/98#issue-331131912.
When you get the redirect URL back in your browser on Windows, it won't connect to the localhost of the remote linux machine. Currently the localhost webserver will wait forever for a response.
To fix this we could
Or
spotify-tuiand parse the response.The latter solution is more involved but might be best.
Potential workaround
In the meantime, you could try making a manual get request on your remote linux machine.
In a separate terminal process try doing something like
curl <the url the from the browser>@eminence commented on GitHub (Nov 5, 2019):
Ahh, great idea on the workaround. That worked perfectly.
@jfaltis commented on GitHub (Nov 6, 2019):
@Rigellute I think it's difficult to implement the second solution since we would need to handle the authentication with spotify.com (username, password). Even if we reliably reconstruct the requests for logging in to spotify.com and get it to work it can fail when changes occur on the spotify.com webpage/login process.
@Rigellute commented on GitHub (Nov 6, 2019):
@jfaltis on reflection you're right. We can't do that!
Instead of the timout, perhaps we could show the manual URL prompt while the server is running? So both methods are valid simultaneously?
@jfaltis commented on GitHub (Nov 7, 2019):
@Rigellute That would be a nice solution but I don't know if it is possible to cancel io::stdin().read_line from the webserver thread when a GET request is received.
@Rigellute commented on GitHub (Nov 7, 2019):
Would be nice if we could somehow
racethe webserver vsread_line🤔@hansmbakker commented on GitHub (Jan 9, 2023):
The proper way for this would be to use the device authorization grant flow - Spotify does this already for its TV applications, but they seem to block other applications from using it.
I explained how this works and requested that they enable it in this feature request - please upvote the idea there if you find it useful.
@tobiasfiechter commented on GitHub (Jul 11, 2023):
Does the token expire someday?