From a43460751571efdf8ea878e90b19d5cdd8595860 Mon Sep 17 00:00:00 2001 From: John King Date: Sat, 15 Apr 2023 20:24:44 +0000 Subject: [PATCH] spotify: fix credentials cache Cache Spotify response instead of username and password. This should resolve frequent "New login to Spotify" emails. Part-of: --- audio/spotify/src/spotifyaudiosrc/imp.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/audio/spotify/src/spotifyaudiosrc/imp.rs b/audio/spotify/src/spotifyaudiosrc/imp.rs index a6461e22..b75b08b9 100644 --- a/audio/spotify/src/spotifyaudiosrc/imp.rs +++ b/audio/spotify/src/spotifyaudiosrc/imp.rs @@ -488,9 +488,7 @@ impl SpotifyAudioSrc { bail!("password is not set and credentials are not in cache"); } - let cred = Credentials::with_password(&settings.username, &settings.password); - cache.save_credentials(&cred); - cred + Credentials::with_password(&settings.username, &settings.password) } }; @@ -505,7 +503,7 @@ impl SpotifyAudioSrc { }; let (session, _credentials) = - Session::connect(SessionConfig::default(), credentials, Some(cache), false).await?; + Session::connect(SessionConfig::default(), credentials, Some(cache), true).await?; let player_config = PlayerConfig { passthrough: true,