Debounce 401 on Security/Check across polling intervals to handle refresh token race#15
Draft
Debounce 401 on Security/Check across polling intervals to handle refresh token race#15
Conversation
…mechanism Co-authored-by: 0fca <25554250+0fca@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add double validation check for logged-in state
Retry Security/Check on 401 to handle refresh token race
Mar 12, 2026
Owner
|
@copilot Okay, let's try another approach. Don't make double hit one after another. If you get 401 for the first time, debounce it waiting another 8s (so just for another interval of Security/Check worker) and if there is still 401 - then show the pop-up. |
Co-authored-by: 0fca <25554250+0fca@users.noreply.github.com>
Contributor
Author
Switched to the debounce approach in
|
Copilot
AI
changed the title
Retry Security/Check on 401 to handle refresh token race
Debounce 401 on Security/Check across polling intervals to handle refresh token race
Mar 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pika Core's refresh token mechanism can cause the
/Security/Checkendpoint to return 401 on the first call while the token is being refreshed. Instead of immediately retrying or logging the user out, the 401 is debounced across the existing 8-second polling interval — only showing the logout prompt if two consecutive checks return 401.src/App.vue: Added ahadPrevious401data flag. On the first 401 (during mount or interval), the flag is set but the user is not logged out. During the initial mount check,authLoadingstaystrueso the loading overlay is shown instead of the login prompt. On the next 8-second interval check, if the endpoint still returns 401, the user is logged out and the popup is shown. If it returns 200, the flag is cleared and the user remains logged in.src/services/securityService.js: No changes — remains a single call to/Security/Check, returningresponse.ok.✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.