Refactor authentication flow to remove localStorage dependencies and improve state management

- Removed localStorage interactions for session tokens and user data in the TelegramLoginButton and authSlice, enhancing security and simplifying the codebase.
- Updated the desktop deep link listener to eliminate localStorage usage for user data, streamlining the authentication process.
- Adjusted the Redux store configuration to remove custom storage for backward compatibility, focusing on a cleaner state management approach.

These changes enhance the application's architecture by centralizing state management and improving maintainability.
This commit is contained in:
Steven Enamakel
2026-01-28 04:31:23 +05:30
parent 4323c4812c
commit f0a49fc167
4 changed files with 3 additions and 99 deletions
+1 -6
View File
@@ -175,7 +175,7 @@ const TelegramLoginButton = ({
}
const exchangeData = await exchangeResponse.json();
const { sessionToken, user } = exchangeData.data;
const { sessionToken } = exchangeData.data;
if (!sessionToken) {
throw new Error('No JWT token received from server');
@@ -183,11 +183,6 @@ const TelegramLoginButton = ({
// Store JWT token in store (this is the JWT from the backend)
dispatch(setToken(sessionToken));
// Store user data in localStorage for backward compatibility
if (user) {
localStorage.setItem('user', JSON.stringify(user));
}
// Call onSuccess callback if provided, otherwise navigate to onboarding
if (onSuccess) {