

Persisting non-sensitive data across app runsĪsync Storage is the React Native equivalent of Local Storage from the web Secure Storage Async Storage is not shared between apps: every app has its own sandbox environment and has no access to data from other apps. Unpersisted data is never written to disk-so there's no data to access! Async Storage Īsync Storage is a community-maintained module for React Native that provides an asynchronous, unencrypted, key-value store. But this also can make that data more vulnerable to being accessed by attackers. Persisted vs unpersisted - persisted data is written to the device’s disk, which lets the data be read by your app across application launches without having to do another network request to fetch it or asking the user to re-enter it. As your app is used, you’ll often find the need to save data on the device, whether to support your app being used offline, cut down on network requests or save your user’s access token between sessions so they wouldn’t have to re-authenticate each time they use the app.
React http private cache code#
Secrets in server side code cannot be accessed by the API consumers the same way secrets in your app code can.įor persisted user data, choose the right type of storage based on its sensitivity. using AWS Lambda or Google Cloud Functions) which can forward the request with the required API key or secret. This could be a serverless function (e.g. If you must have an API key or a secret to access some resource from your app, the most secure way to handle this would be to build an orchestration layer between your app and the resource. Tools like react-native-dotenv and react-native-config are great for adding environment-specific variables like API endpoints, but they should not be confused with server-side environment variables, which can often contain secrets and API keys. Anything included in your code could be accessed in plain text by anyone inspecting the app bundle. Never store sensitive API keys in your app code. This is not a preflight checklist-it is a catalogue of options, each of which will help further protect your app and users.


In this guide, you will learn about best practices for storing sensitive information, authentication, network security, and tools that will help you secure your app. Although an ordinary padlock is pickable, it is still much harder to get past than a cabinet hook! However, the probability of falling victim to a malicious attack or being exposed for a security vulnerability is inversely proportional to the effort you’re willing to put in to protecting your application against any such eventuality.
React http private cache software#
It is true that it is impossible to build software that is completely impenetrable-we’ve yet to invent a completely impenetrable lock (bank vaults do, after all, still get broken into). Security is often overlooked when building apps.
