[GH-ISSUE #1255] Gracefully handle JWT experation #717

Closed
opened 2026-02-26 02:34:03 +03:00 by kerem · 2 comments
Owner

Originally created by @fschlaef on GitHub (Nov 10, 2020).
Original GitHub issue: https://github.com/koel/koel/issues/1255

Describe the bug
When session timeout is reached and I try to play a song, it doesn't because I'm not logged in anymore. However, instead of redirecting me to login page or displaying an alert, Koel tries to play all songs in the playlist in rapid succession, which doesn't work but spams the API with calls, which eventually leads to a 429 - Too Many Requests error.

Reloading the page displays the login screen with no alert shown, but developer console shows the error.

Waiting a couple minutes resolves the issue

To reproduce
Login
Wait for session timeout (don't know how long it is, I locked the session for ~2 hours)
Attempt to start a playlist

Expected behavior
An error is shown, or redirection to login page

Environment

  • Koel version v4.4.0
  • OS: Windows 10
  • Browser Chrome 86
  • PHP version 7
  • Node version 10
Originally created by @fschlaef on GitHub (Nov 10, 2020). Original GitHub issue: https://github.com/koel/koel/issues/1255 **Describe the bug** When session timeout is reached and I try to play a song, it doesn't because I'm not logged in anymore. However, instead of redirecting me to login page or displaying an alert, Koel tries to play all songs in the playlist in rapid succession, which doesn't work but spams the API with calls, which eventually leads to a 429 - Too Many Requests error. Reloading the page displays the login screen with no alert shown, but developer console shows the error. Waiting a couple minutes resolves the issue **To reproduce** Login Wait for session timeout (don't know how long it is, I locked the session for ~2 hours) Attempt to start a playlist **Expected behavior** An error is shown, or redirection to login page **Environment** - Koel version v4.4.0 - OS: Windows 10 - Browser Chrome 86 - PHP version 7 - Node version 10
Author
Owner

@BrookeDot commented on GitHub (Dec 30, 2020):

I think this will also fix #847 and #1228.

I agree that ideally, invalid token would redirect back to the login page. Might also be good to allow the token expiration to be customized.

<!-- gh-comment-id:752340346 --> @BrookeDot commented on GitHub (Dec 30, 2020): I think this will also fix #847 and #1228. I agree that ideally, invalid token would redirect back to the login page. Might also be good to allow the token expiration to be customized.
Author
Owner

@phanan commented on GitHub (Dec 30, 2020):

Invalid tokens should redirect back to the login page indeed. I've attempted several times in the past, but for some reason it never really worked. This, however, won't be a problem anymore in the next major version of Koel, as we're switching to Laravel Sanctum with basically non-expiring tokens.

<!-- gh-comment-id:752792310 --> @phanan commented on GitHub (Dec 30, 2020): Invalid tokens should redirect back to the login page indeed. I've attempted several times in the past, but for some reason it never really worked. This, however, won't be a problem anymore in the next major version of Koel, as we're switching to Laravel Sanctum with basically non-expiring tokens.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/koel-koel#717
No description provided.