Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix: clear authentication tokens on user deletion

Piyush Gupta422136b7bed3
diff --git a/frontend/src/hooks/api/users/queries.tsx b/frontend/src/hooks/api/users/queries.tsx
index 22d4f39d82..d7623da935 100644
--- a/frontend/src/hooks/api/users/queries.tsx
+++ b/frontend/src/hooks/api/users/queries.tsx
@@ -1,6 +1,7 @@
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { AxiosError } from "axios";
+import SecurityClient from "@app/components/utilities/SecurityClient";
import { apiRequest } from "@app/config/request";
import { SessionStorageKeys } from "@app/const";
import { queryClient as qc } from "@app/hooks/api/reactQuery";
@@ -86,6 +87,8 @@ export const useDeleteMe = () => {
localStorage.removeItem("tag");
localStorage.removeItem("PRIVATE_KEY");
localStorage.removeItem("orgData.id");
+ setAuthToken("");
+ SecurityClient.setToken("");
queryClient.clear();
}