React Native Web (Expo Managed) Token Based Auth Credentials Storage

Hi,

Is there a proper way to store our API Token in a React Native Web project?

In our iOS/Android React Native projects we use SecureStorage. Is there a technology or technique appropriate for React Native Web?

More info…

We built a React Native (Expo Managed) cross-platform app which our users really enjoy.

The one complaint that our users have is that the app doesn’t keep them logged in. Each time they close the browser, they have to login again. The same thing happens when they hit the back button in the browser.

  • Expo v39
  • React Native Web ~0.13.12
  • React Navigation 5

We are happy to update the SDK or other packages if there is a solution to this issue.

Regards,

Jim C

Hey @meta1, most often with web projects the LocalStorage API from the browser is leveraged but it’s handled synchronously unlike AsyncStorage or SecureStore. One option from the community is this package which handles unify the behavior between platforms.

Cheers,
Adam

This looks very promising. Thank you very much.

After some research, it appears that storing Tokens in LocalStorage is considered insecure because it is susceptible to XSS.

Is there any other alternative?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.