Skip to content

[BUG] iOS users getting logged out #3466

@simsolden

Description

@simsolden

Summary

On iOS, users are automatically logged out after some time when using the SFCC PWA in a WebView. This does not happen on Android.

Steps To Reproduce

  1. Set up a clean SFCC PWA project using the basic scaffold.
  2. Use example data from RefArch in Business Manager.
  3. Wrap the PWA in an Expo React Native WebView (default config, no cookies or headers manually overridden).
  4. Log in with a shopper account.
  5. Leave the app idle for X minutes or background it. This is variable and can be after 30 minutes or sometimes after a day or more.
  6. Return to the app — user is logged out.

Expected result

The session should persist as long as it does on Android or in mobile browsers.

Actual result

On iOS, the session expires and the user is logged out after a period of inactivity.

System Information (as applicable)

Browser: iOS Webview
Node version: 22
pwa-kit version: 3.13
Mobile Device Info: iOS 18.x

Additional information

It seems to be linked to the way cookies are handled. We managed to fix the issue internally by patching the @salesforce/commerce-sdk-react library and using localStorage as storage type instead of cookies but a structural fix would be prefered.

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