-
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,7 @@ export const useAuthActions = () => { | |
| return { | ||
| logout: () => { | ||
| localStorage.removeItem('jwtToken'); | ||
| localStorage.removeItem('refreshToken'); | ||
| localStorage.setItem('tokenRemovalTime', Date.now().toString()); | ||
| queryClient.invalidateQueries({ queryKey: AUTH_QUERY_KEY }); | ||
| }, | ||
btwshivam marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
@@ -45,6 +46,7 @@ export const useAuthActions = () => { | |
|
|
||
| export const logout = () => { | ||
| localStorage.removeItem('jwtToken'); | ||
| localStorage.removeItem('refreshToken'); | ||
|
Comment on lines
48
to
+49
|
||
| localStorage.setItem('tokenRemovalTime', Date.now().toString()); | ||
| window.dispatchEvent(new Event('storage')); | ||
| }; | ||
|
|
||
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 infrontend/src/components/login/tokenUtils.tsthat 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 inuseLogin.tsalready usesclearTokens()).