mirror of
https://github.com/Rigellute/spotify-tui.git
synced 2026-04-26 16:15:55 +03:00
[GH-ISSUE #410] 400 Only Valid Bearer Authentication Supported #168
Labels
No labels
bug
enhancement
good first issue
help wanted
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotify-tui#168
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @sputnick1124 on GitHub (Apr 22, 2020).
Original GitHub issue: https://github.com/Rigellute/spotify-tui/issues/410
Occasionally (usually after
spthas been running for some time), playback will be frozen and any action will result in a "400 Only Valid Bearer Authentication Supported" error from the API.Wondering if we can handle 400's with a re-auth routine or something similar. If we need better/more granular errors from
rspotify, I am working on putting together a PR to address better error descriptions and can work something out there.@Rigellute commented on GitHub (Apr 22, 2020):
We currently try to perform reauth when the token has expired (here). Perhaps this isn't working properly anymore?
Having more granular errors from
rspotifywould be great actually, thanks for looking into that!@TimotheeGerber commented on GitHub (Apr 25, 2020):
I have the same issue. Re-authentication is not working correctly all the time. I checked the code and I think I found the problem.
Re-authentication is done when
Instant::now() > app.spotify_token_expiry. These expiration date is computed here, with the current time + token lifetime (expires_in). The problem is that the current time is not the time the token started to be valid when we are using a cached version of the token. As a consequence, it happens that the expiration date is too far in the future to trigger re-authentication.To solve this problem, the expiration date should be computed from the
expires_atfield. Unfortunately, it seems there is nofrom_timestampfunction instd::time. I don't want to add another dependency just for that. I will try something and propose a PR if it works.@TimotheeGerber commented on GitHub (Apr 25, 2020):
I found a way to mimic a
from_timestampfunction in Rust. I put it here in case someone is interested:I used this on the
expires_attoken field to propose the fix for this issue.