mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-30 23:14:37 +00:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user