Skip to content

Logout and Session Expiration Not Redirecting to Login Screen in React Native v13.1.0 #2789

@abhinavRepo26

Description

@abhinavRepo26

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:

  1. On logout button click, app should redirect to login screen
  2. When session expires, automatic redirect to login screen should occur
  3. Consistent behavior across both Android and iOS

Current Behavior:

  1. Logout button click does not trigger navigation to login screen
  2. Session expiration does not automatically redirect to login
  3. 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
}
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions