spotifyd
spotifyd copied to clipboard
Receiving the Authorization code
I'm using Spotifyd as a replacement for Spotify App on my Linux Machine. I have created a Unity UI for controlling my music. The first time that I start Spotifyd and try to connect to it using my program the spotify page will open in Firefox and ask me to give permission. But after giving permission the callback will try to return a code to the localhost. But unlike Spotify App, Spotifyd ignores. I'm not %100 sure what I'm doing, but if I stop Spotifyd and run the official Spotify App, the callback gets called properly and I create a PKCE file that I'll use from then on. Even if I stop the official Spotify App and start spotifyd, everything works perfectly. It's just the initial setup. Can you please help me out understand what I'm doing wrong?
Hi!
It's not entirely clear to me, what you are trying to achieve. I'm guessing that you want to build something similar to spotify-tui, more specifically a frontend for the Spotify Web API.
If this is the case, then spotifyd
probably isn't related to your problem. What spotifyd
does, is serving as a client that shows up as a playback device in frontends like the official Spotify App or spotify-tui. It does not provide a way to receive the authorization code from the auth flow, what you seem (?) to describe in the issue.
I probably misunderstood, what you explained in your comment. Can you try to elaborate on what exactly you want to do and especially what you'd expect from spotifyd
in all this?
Thanks for your reply eladyn. Yes. I'm trying to create a UI for spotify's web API, just like spotify-tui. Since they are also using spotifyd, I expected my UI to work just like their's (because they can also use the official spotify app or spotifyd interchangeably). I will dig a little deeper in spotify-tui's code and see how they have implemented it that could use spotifyd as a backend too. I thought maybe working with oath and the spotify web API is behind a feature flag or something and I've missed it.
In this case, I don't think that spotifyd is at all related to your problem. The Authorization Code Flow requires you to have client credentials, redirect the user to the authorization page (which you seem to have done) and have a webserver running at the redirect URI, which can then receive the auth code. None of those steps actually even require the official app or spotifyd
to be up and running.
spotifyd
itself doesn't really provide you with direct means to interact with the web API. That should be possible independently from the "backend". So if you have any questions about spotifyd
directly, I'll be happy to help you get further. Otherwise, I think that you might indeed be better off - as you said - digging through the source code of some applications that have already implemented this auth flow. (I personally found the implementation of the spotipy
python library quite readable, they also include the PKCE version.)