-
Notifications
You must be signed in to change notification settings - Fork 458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement OAuth and refactor config #1321
base: master
Are you sure you want to change the base?
Conversation
Co-Authored-By: dotandl <[email protected]>
This greatly refactors and simplifies the config parsing. Also, it removes the possiblity to specify user and password, since this has been phased out by Spotify and will be replaced by OAuth.
3855db0
to
836fbfa
Compare
I understand this as the username, password and password_cmd in the configuration file will now be ignored, and login requires some manual steps in a web browser. Correct? |
Yes, that's correct. Alternatively we could maybe keep them around for now and warn the user, when they are encountered... |
This builds on top of #1317 and implements the missing OAuth support, which replaces the no longer available username + password method. Since this required some refactoring of the configuration anyway, I replaced
structopt
with the (actively developed)clap
, which is the successor ofstructopt
.By removing the username + password method, we basically get rid of all the sensitive value handling, e.g. the keyring. (Well, one could still store the cached credentials in the keyring, but that hasn't happened before either, so this could be a future extension.)
The OAuth support is a bit clunky at the moment and surely could use some refinement in the future, but since this has been missing for quite some time now, it's probably better to put it out there and iterate on that later.
If I'm not mistaken, all configuration changes should be backwards compatible so far (or at least not error on previously working configs, of course username or password values are no longer used).
The current design of the authentication is as follows:
spotifyd auth(enticate)
subcommand, one initiates the OAuth process and is directed to accounts.spotify.com. After logging in there, we receive the token and exchange it for a longer-lived credential blob. This blob is stored at$cache_directory/oauth/credentials.json
spotifyd
finds an authentication blob fromoauth
on startup, it uses that for the first session.--disable-discovery
ordisable_discovery = true
(even if an oauth blob is present), discovery is started and selecting a device there ends the current session and starts a new one.$cache_directory/credentials.json
and will be used on startup, when nooauth
blob can be found.Closes #800, closes #778 (due to configuration refactor).
Fixes #1293 (oauth support).
Fixes #1212 (new credential caching logic, no usernames necessary anymore).
Any testing is highly appreciated! Also, none of the changes have been documented so far so that still has to be done before a release.