Open rajalot opened 3 years ago
Same for me. Every time my computer sleeps, or I close/reopen lofi. Bummer because I would LOVE using lofi long term!
I am also having this issue. It also happens to me if I stop playback for an extended period of time.
Thanks for the reports, folks. This might either be due to Spotify throttling or due to the (free) Heroku auth instance hiccupping. I'll look into this, time permitting. Merry Christmas, Happy Holidays, etc.!
It's happening again... I'm also being logged out randomly on occasion
Fixed in the next version (1.6.0+ no longer needs auth backend -- releasing soon).
@dvx Since I am using Lofi, I experience the same issue on MacOS. What could it be?
If you're running on a laptop that has power saving, the refresh token may time out forcing you to log back in whenever your laptop goes to sleep.
I noticed that when my MAC isn't plugged in, I have to log in more often.
@stamoun I do not use Low Power mode, I disable Turbo Boost though. I have to login each session, but I get the problem now. You constantly have to refresh the token in the background. I explicitly told my Mac to disable Wifi and Bluetooth when it goes to sleep and I also disable Power Nap. So yes, there is no chance your little app will refresh any token when my Mac is closed. I prefer this, because I don't like the forced connectivity by the device, I guess that's the problem then.
I wish the token had more lifetime. What is it lifetime anyways?
That's the way PKCE works sadly...
https://developer.spotify.com/documentation/general/guides/authorization/code-flow/
IIRC they expire after 30mins, that's what Spotify is returning to us, not much can be done, it's for security purposes because everything happens locally instead of remotely on a protected server...
@stamoun I get that, thanks for clarifying. Maybe the login process it could be improved to be seamless? If it was using a small popup WebView that would remember my Spotify session, it wouldn't change spaces, because my browser is on a dedicated space. Also I wonder why it is necessary to authenticate in the first place. This Apple Spotify Widget doesn't ask me to sign-in. Apparently there is a way to get this information from the Spotify client directly.
@stamoun I get that, thanks for clarifying. Maybe the login process it could be improved to be seamless? If it was using a small popup WebView that would remember my Spotify session, it wouldn't change spaces, because my browser is on a dedicated space. Also I wonder why it is necessary to authenticate in the first place. This Apple Spotify Widget doesn't ask me to sign-in. Apparently there is a way to get this information from the Spotify client directly.
This seem to rely on some MacOS functionality, so not cross platform. It also assumes that Spotify is running whereas, at some point, Iād like to switch to the web player sdk (keep the REST calls as is for freemium accounts).
@stamoun You might want to read this: https://github.com/Peter-Schorn/SpotifyAPIServer/issues/2#issuecomment-1564940678
Essentially, only the access token loses validity, but the refresh token should not. So I think this issue is actually solvable. Could it be that you do not store the refresh token at the end of the session in the assumption that it will be invalid anyways? This would definitely not be the case.
Reopening, I'll investigate the fix. I remember following Spotify's PKCE flow but that was 2 years ago, maybe I missed something.
@stamoun Thanks. For the matter of fact, I do host his SpotifyAPIServer locally and my device is off the grid for hours every night, never had to re-authenticate. I'm sure you will find something. His code shall be helpful in doing so.
Hello dvx, So I've been using Lofi for a while now but it seems like it doesn't remain logged into Spotify - and it means that I have to login Spotify every time I restart/turn off my device. Anything ideas?