librespot-org / librespot

Open Source Spotify client library
MIT License
4.86k stars 616 forks source link

Session expires: PermissionDenied, error: StatusCode(403) #1389

Closed abrakadabra2k closed 1 day ago

abrakadabra2k commented 3 days ago

Description

After a random time period (around 1 hour, but not exactly 1h like in 1377 ) no music is played anymore. It seems this is happening after a Token expiration event. After restarting librespot, everything is working fine

Version

0.5.0

How to reproduce

Running librespot in Moode's default settings That should mean librespot is running with authentication via SpotifyConnect (started on an Android device).

[2024-11-01T13:46:27Z TRACE librespot] Command line argument(s): [2024-11-01T13:46:27Z TRACE librespot] name "ServerMoode Spotify" [2024-11-01T13:46:27Z TRACE librespot] bitrate "320" [2024-11-01T13:46:27Z TRACE librespot] format "S16" [2024-11-01T13:46:27Z TRACE librespot] mixer "softvol" [2024-11-01T13:46:27Z TRACE librespot] initial-volume "100" [2024-11-01T13:46:27Z TRACE librespot] volume-ctrl "log" [2024-11-01T13:46:27Z TRACE librespot] volume-range "60" [2024-11-01T13:46:27Z TRACE librespot] cache "/var/local/www/spotify_cache" [2024-11-01T13:46:27Z TRACE librespot] disable-audio-cache [2024-11-01T13:46:27Z TRACE librespot] backend "alsa" [2024-11-01T13:46:27Z TRACE librespot] device "plughw:Loopback,0" [2024-11-01T13:46:27Z TRACE librespot] onevent "/var/local/www/commandw/spotevent.sh" [2024-11-01T13:46:27Z TRACE librespot] v

I have a couple of devices running the spotify client. It seems my Echo Dot takes over the client role frequently: Line 34927: [2024-11-01T11:54:50Z DEBUG librespot_playback::player] command=EmitSessionClientChangedEvent("9a8d2f0ce77a4e248bb71fefcb557637", "Pixel 6a", "google", "Pixel 6a") Line 35286: [2024-11-01T11:54:51Z DEBUG librespot_playback::player] command=EmitSessionClientChangedEvent("27d4dfe427b34d57995b463e5d63198d", "db51dfff-8c44-4a27-83d9-18be1dc34854", "Amazon", "Echo_Dot") Line 40554: [2024-11-01T12:07:09Z DEBUG librespot_playback::player] command=EmitSessionClientChangedEvent("756a522d9f1648b89e76e80be654456a", "Grundig Android TV", "ARCELIK", "GrundigAndroidTV") Line 45366: [2024-11-01T12:21:07Z DEBUG librespot_playback::player] command=EmitSessionClientChangedEvent("9a8d2f0ce77a4e248bb71fefcb557637", "Pixel 6a", "google", "Pixel 6a") Line 45725: [2024-11-01T12:21:08Z DEBUG librespot_playback::player] command=EmitSessionClientChangedEvent("27d4dfe427b34d57995b463e5d63198d", "db51dfff-8c44-4a27-83d9-18be1dc34854", "Amazon", "Echo_Dot") Line 52288: [2024-11-01T12:39:43Z DEBUG librespot_playback::player] command=EmitSessionClientChangedEvent("9a8d2f0ce77a4e248bb71fefcb557637", "Pixel 6a", "google", "Pixel 6a") Line 52648: [2024-11-01T12:39:44Z DEBUG librespot_playback::player] command=EmitSessionClientChangedEvent("27d4dfe427b34d57995b463e5d63198d", "db51dfff-8c44-4a27-83d9-18be1dc34854", "Amazon", "Echo_Dot") Line 58873: [2024-11-01T13:10:05Z DEBUG librespot_playback::player] command=EmitSessionClientChangedEvent("756a522d9f1648b89e76e80be654456a", "Fire TV", "Amazon", "AFTKA") Line 59309: [2024-11-01T13:15:50Z DEBUG librespot_playback::player] command=EmitSessionClientChangedEvent("9a8d2f0ce77a4e248bb71fefcb557637", "Pixel 6a", "google", "Pixel 6a") Line 59669: [2024-11-01T13:15:50Z DEBUG librespot_playback::player] command=EmitSessionClientChangedEvent("27d4dfe427b34d57995b463e5d63198d", "db51dfff-8c44-4a27-83d9-18be1dc34854", "Amazon", "Echo_Dot")

So far, this has been happening in every session.

Log

see for exact position of error https://pastebin.com/aLck4imV

Host (what you are running librespot on):

running on Moode 9.1.4 with Raspberry Pi 4 (multiroom mode, but that should not matter)

Additional context

Android device (Pixel 6a) shows still the librespot device as "connected"

roderickvd commented 3 days ago

Please try with 0.6.0 that was released days ago.

kingosticks commented 3 days ago

We should fix these logs to redact the tokens.

abrakadabra2k commented 1 day ago

It seems the issue is solved with 0.6.0 24hours uninterrupted playback. This was never achieved with previous versions on my setup