-
Notifications
You must be signed in to change notification settings - Fork 392
Description
I'm experiencing issues with logout functionality and session expiration redirection in my React Native app using Salesforce Mobile SDK v13.1.0. When users click the logout button or when sessions expire, the app fails to redirect to the login screen on both Android and iOS platforms.
Environment Details:
react-native-force: "git+https://github.com/forcedotcom/SalesforceMobileSDK-ReactNative.git#v13.1.0"
SalesforceMobileSDK-Android: "https://github.com/forcedotcom/SalesforceMobileSDK-Android.git#v13.1.0"
SalesforceMobileSDK-iOS: "https://github.com/forcedotcom/SalesforceMobileSDK-iOS.git#v13.1.0"
react: "19.0.0"
react-native:"0.79.3"
Expected Behavior:
- On logout button click, app should redirect to login screen
- When session expires, automatic redirect to login screen should occur
- Consistent behavior across both Android and iOS
Current Behavior:
- Logout button click does not trigger navigation to login screen
- Session expiration does not automatically redirect to login
- App remains on current screen or becomes unresponsive
Here is my logout specific code -->
export const logoutUser = async (): Promise => {
try {
// Clear all stale query data
queryClient.clear();
// 1. Reset SmartStore first
await resetSmartStore();
// 2. Clean all MMKV storage
cleanMMKVStorage();
// 3. Execute Salesforce logout
return new Promise((resolve, reject) => {
oauth.logout(
(res: any) => {
resolve(res);
},
(err: any) => {
const errorMessage = `Salesforce logout failed: ${
err?.message || JSON.stringify(err)
}`;
reject(new Error(errorMessage));
},
);
});
} catch (err) {
// Handle error silently or re-throw based on your needs
}
};