-
Notifications
You must be signed in to change notification settings - Fork 221
fix: remove refreshToken during logout process #2306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
Signed-off-by: Abhishek-Punhani <[email protected]>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @Abhishek-Punhani. Thanks for your PR. I'm waiting for a kubestellar member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR addresses a critical bug where the logout functionality was causing the application to freeze or enter an infinite redirect loop. The root cause was that only the jwtToken was being removed during logout, while the refreshToken remained in localStorage, potentially causing authentication conflicts.
- Added
localStorage.removeItem('refreshToken')to both logout implementations inuseAuth.ts - Ensures complete cleanup of authentication tokens during sign out
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| localStorage.removeItem('jwtToken'); | ||
| localStorage.removeItem('refreshToken'); |
Copilot
AI
Dec 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a clearTokens() utility function already available in frontend/src/components/login/tokenUtils.ts that handles removing both jwtToken and refreshToken. Consider using that function instead of manually removing tokens to maintain consistency with other logout implementations in the codebase (e.g., the logout function in useLogin.ts already uses clearTokens()).
| localStorage.removeItem('jwtToken'); | ||
| localStorage.removeItem('refreshToken'); |
Copilot
AI
Dec 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a clearTokens() utility function already available in frontend/src/components/login/tokenUtils.ts that handles removing both jwtToken and refreshToken. Consider using that function instead of manually removing tokens to maintain consistency with other logout implementations in the codebase (e.g., the logout function in useLogin.ts already uses clearTokens()).
| logout: () => { | ||
| localStorage.removeItem('jwtToken'); | ||
| localStorage.removeItem('refreshToken'); | ||
| localStorage.setItem('tokenRemovalTime', Date.now().toString()); | ||
| queryClient.invalidateQueries({ queryKey: AUTH_QUERY_KEY }); | ||
| }, |
Copilot
AI
Dec 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logout functions lack test coverage. Consider adding unit tests to verify that both jwtToken and refreshToken are properly removed during logout, especially given this is fixing a critical bug. Tests would help prevent regression of this issue.
|
/ok-to-test |
Description
This PR fixes a critical bug where the application would freeze or enter an infinite redirect loop when a user clicked "Sign Out".
Related Issue
Fixes #2305
Changes Made
useAuth.tsto explicitly remove therefreshTokenalong with jwtTokenChecklist
Please ensure the following before submitting your PR:
Screenshots or Logs (if applicable)
2025-12-30.23-17-12.mp4
Additional Notes