How to Store Data Securely in Your Expo App

DavidDavid November 13, 2026 8 min read
A brushed-steel lockbox with its lid slightly open on a dark walnut desk, a brass key and a smartphone lying beside it under warm low lamp light
Original image, App Store Launch Club

How to store data securely in your Expo app, in short

Install expo-secure-store. Import it with import * as SecureStore from 'expo-secure-store'. Save a value with await SecureStore.setItemAsync('session_token', token). Read it back with await SecureStore.getItemAsync('session_token'), which gives you the string or null. Remove it on sign-out with await SecureStore.deleteItemAsync('session_token').

On iOS the value is stored in the Keychain. On Android it is stored in SharedPreferences, encrypted with a key held in the Android Keystore. Each app gets its own storage and cannot read another app's entries. That is the difference between this and AsyncStorage, which writes plain, unencrypted data.

expo-secure-store at a glance (SDK 58)

QuestionAnswer
Installnpx expo install expo-secure-store
PlatformsAndroid, iOS, tvOS. Not web
Works in Expo Go?Yes, except requireAuthentication on devices with biometrics
Save / read / deletesetItemAsync, getItemAsync, deleteItemAsync
Sync versionssetItem and getItem (they block the JS thread)
Value typeStrings only
Key charactersLetters, numbers, dot, dash and underscore
iOS storageKeychain
Android storageSharedPreferences encrypted with the Android Keystore

What belongs in SecureStore (and what does not)

SecureStore is a small, locked drawer, not a filing cabinet. Use it for the handful of values that would hurt if someone pulled them off the phone, and keep everything else somewhere built for volume.

Where each kind of data should live

DataWhereWhy
Session token, refresh tokenexpo-secure-storeWhoever holds it is signed in as the user
An API key the user pasted into your appexpo-secure-storeIt is their credential, not yours
A flag like biometricLockEnabledexpo-secure-store or AsyncStorageNot secret, but it is often read next to the token
Settings, onboarding done, themeAsyncStorageNot sensitive, and you want it fast and simple
Lists, records, offline contentA local database such as expo-sqliteToo big and too structured for a key-value secret store
Your own backend secret keysNowhere in the appAnything shipped in the app binary can be extracted

For records and offline content, see our guide to [adding a local database](/blog/how-to-add-a-local-database-to-your-expo-app). The last row is the one that bites people. A secret key for your payment provider or AI API does not become safe because it sits in SecureStore. It is still inside a binary anyone can download. Those keys stay on your server, and the app talks to your server. Our guide to [environment variables in Expo](/blog/how-to-manage-environment-variables-in-expo) covers which values are fine to ship and which are not.

Step 1: Install expo-secure-store and add the config plugin

Run npx expo install expo-secure-store. On SDK 58 that installs the 58.0.x line. It is included in Expo Go, so the basic save and read calls work on your phone straight away.

For your real builds, add the config plugin to app.json under plugins as ["expo-secure-store", { ... }]. It has two options:

  • faceIDPermission (iOS): the text for the NSFaceIDUsageDescription prompt. You only need it if you plan to use requireAuthentication, but if you do and it is missing, biometric reads will not work.
  • configureAndroidBackup (Android, default true): tells Android Auto Backup to skip SecureStore's entries. Those entries cannot be decrypted after a restore, because their Keystore keys are deleted when the app is uninstalled. Leave it on unless you already have your own backup rules, in which case exclude the SecureStore file under the sharedpref domain yourself and set this to false.

If App Store Connect asks you about encryption when you upload, SecureStore is a common reason. Setting ios.config.usesNonExemptEncryption to false in app.json answers that question for you. Our post on the [missing compliance warning](/blog/missing-compliance-app-store-connect) explains when that answer is honest for your app.

Step 2: Save, read and delete values

Wrap the three calls in one small file, for example lib/secure.ts, so the rest of your app never touches key names directly. In words: saveToken(token) calls SecureStore.setItemAsync(TOKEN_KEY, token), getToken() returns SecureStore.getItemAsync(TOKEN_KEY), and clearToken() calls SecureStore.deleteItemAsync(TOKEN_KEY).

  • Values must be strings. To store an object, JSON.stringify it on the way in and JSON.parse it on the way out. Keep it small.
  • Keys may only use letters, numbers, dot, dash and underscore. A key like user:token or an email address as a key will fail. Use session_token or auth.refresh.
  • getItemAsync resolves to null when nothing is stored under that key. Treat null as "signed out", not as an error.
  • Every call can reject. Catch errors and fall back to the signed-out screen rather than leaving the user on a blank loading state.

There are also synchronous versions, setItem and getItem. They are handy for reading a token once during startup, but they block the JavaScript thread while they run. If the value is protected by biometrics, the app is frozen until the user finishes the Face ID prompt. Default to the async versions.

Step 3: Choose when the value can be read on iOS

On iOS, the keychainAccessible option controls when a stored value can be read. The default is SecureStore.WHEN_UNLOCKED: the value is only readable while the phone is unlocked. That is right for almost every foreground app.

The keychainAccessible levels that matter

LevelReadable whenUse it for
WHEN_UNLOCKED (default)The phone is unlockedMost apps
AFTER_FIRST_UNLOCKAny time after the first unlock since restart, even while lockedBackground tasks that call your API with the token
WHEN_PASSCODE_SET_THIS_DEVICE_ONLYUnlocked, and only if the phone has a passcode. Deleted if the passcode is removedHigh-risk values you never want on an unprotected phone
The _THIS_DEVICE_ONLY variantsSame as their base level, but never moved to a new phone from a backupTokens you would rather re-issue than migrate
ALWAYSAny time, even lockedNothing. It is deprecated as the least secure option

The trap is background work. If you [run background tasks](/blog/how-to-run-background-tasks-in-your-expo-app) that need the session token, a WHEN_UNLOCKED token cannot be read while the phone sits locked in a pocket, and the task fails quietly. Store that token with AFTER_FIRST_UNLOCK. Overwriting an existing entry with the option set updates its level. Overwriting it without the option keeps whatever level it was saved with.

Step 4: Handle the iOS reinstall trap

Here is the behavior that surprises almost everyone. On Android, SecureStore data is deleted when the app is uninstalled. On iOS, Keychain data can survive an uninstall and come back when the app is reinstalled with the same bundle ID. It is not guaranteed either way, so you cannot rely on it to keep data or to wipe it.

In practice that means a user deletes your app, reinstalls it weeks later, and opens it to find themselves already signed in with an old token, sometimes for a different account than they expected. It also means a tester who deletes and reinstalls to "start fresh" does not get a fresh start.

Treat SecureStore as a place to keep a secret, not the only copy of anything. Anything you cannot afford to lose, like account data, belongs on your server, where a token can fetch it again.

Step 5: Lock a value behind Face ID (optional)

Pass requireAuthentication: true in the options and the system asks for biometrics before the value can be used. Add authenticationPrompt to set the message. Check SecureStore.canUseBiometricAuthentication() first, since it returns false when the device has no secure biometric method enrolled.

  • It behaves differently per platform. On Android, every operation needs authentication. On iOS, the prompt appears when reading or updating an existing value, not when first creating it.
  • If the user adds a fingerprint or changes their face profile, the value is invalidated and reads return null. Your app needs a normal sign-in path for that moment.
  • If the user cancels or the prompt times out, the call rejects with the native error message. Catch it and treat it as "try again or sign in", not as broken data.
  • It does not work in Expo Go on devices with biometrics. Use a development build with the faceIDPermission plugin option set, and test on a real phone, because simulators do not demand biometrics when reading.

For most indie apps, a simpler Face ID gate in front of the app is the better user experience. We compare both approaches in [how to add Face ID to your Expo app](/blog/how-to-add-face-id-to-your-expo-app).

Step 6: Plan for web

expo-secure-store does not run on the web. SecureStore.isAvailableAsync() resolves true only on Android and iOS. If your Expo app also ships to the web, put a platform check in your helper file: native uses SecureStore, web uses whatever your auth provider recommends for browsers. Hiding that split inside lib/secure.ts keeps the rest of your code identical on every platform.

If you use Supabase, its client needs a storage adapter for exactly this reason. The [Supabase with Expo](/blog/how-to-set-up-supabase-with-expo) guide shows the SecureStore adapter, and our [authentication guide](/blog/how-to-add-authentication-to-your-expo-app) covers the full sign-in flow around it.

Have Claude Code build it for you

Open your project in the Claude Code desktop app and describe the result you want. Left alone, AI-written code for this often stores tokens in AsyncStorage, uses keys with colons or email addresses, forgets the null case, crashes on web, or ignores the iOS reinstall behavior. A prompt that heads those off:

Then add a line to your [CLAUDE.md](/blog/claude-md-for-expo-apps) such as "Secrets: tokens only in expo-secure-store via lib/secure.ts, never AsyncStorage, never backend keys in the app" so later sessions keep the same rules.

The short version

To store data securely in your Expo app: install expo-secure-store, keep small secrets like tokens in it with setItemAsync, read them with getItemAsync and handle null, and clear them with deleteItemAsync on sign-out. Leave the default WHEN_UNLOCKED unless background work needs AFTER_FIRST_UNLOCK, add a first-launch wipe for the iOS reinstall case, and keep backend secrets off the phone entirely.

If you are building your first iOS app with Claude Code and Expo and want feedback on it before App Review, bring it to App Store Launch Club. Members share their builds and help each other get unstuck, and the [curriculum](/curriculum) covers the full path from first build to first users. If sign-in is next on your list, our guide to [adding Sign in with Apple](/blog/how-to-add-sign-in-with-apple-to-your-expo-app) pairs well with this one. Join at applaunchclub.co for $9 a month.

Free app-building tips, straight to your inbox

Short, practical drops on app ideas, validating fast, store listings, and passing app review. No spam, unsubscribe anytime.

Frequently asked questions

How do I store data securely in Expo?

Install expo-secure-store with npx expo install expo-secure-store. Save with SecureStore.setItemAsync(key, value), read with SecureStore.getItemAsync(key), and delete with SecureStore.deleteItemAsync(key). Values are encrypted in the iOS Keychain and in Keystore-encrypted storage on Android.

What is the difference between SecureStore and AsyncStorage?

SecureStore encrypts values using the platform's secure storage and is meant for small secrets like tokens. AsyncStorage stores plain, unencrypted data and is meant for non-sensitive settings and state.

Does expo-secure-store work on the web?

No. It runs on Android, iOS and tvOS, and isAvailableAsync resolves true only on Android and iOS. Use a platform check and a browser-safe fallback for web.

Is SecureStore data deleted when the app is uninstalled?

On Android, yes. On iOS, Keychain data can persist and come back if the app is reinstalled with the same bundle ID, though that is not guaranteed. Add a first-launch check that clears your SecureStore keys if you want reinstalls to start signed out.

How much data can I store in SecureStore?

Keep it small. Some older iOS releases refused values above roughly 2 KB, and Expo does not enforce a limit, so store tokens rather than whole objects and catch errors on write.

Does expo-secure-store work in Expo Go?

Yes for normal save, read and delete. The requireAuthentication option does not work in Expo Go on devices with biometrics, so use a development build with the faceIDPermission config plugin option for that.

Last reviewed by David on November 13, 2026

David

Written by

David

Founder and app builder

Keep reading

ExpoClaude Code

How to Add Notification Actions to Your Expo App

To add notification actions to an Expo app, register a category with Notifications.setNotificationCategoryAsync, give it action buttons (and optionally a text reply), set categoryIdentifier on the notification, then read response.actionIdentifier in a response listener. Here is every action option, how to handle taps when the app was closed, the Android and iOS differences, and a Claude Code prompt that wires it all up.

David 8 min
Read article
ExpoClaude Code

How to Schedule Local Notifications in Your Expo App

To schedule local notifications in an Expo app, install expo-notifications, set a notification handler, ask for permission, create an Android channel, then call scheduleNotificationAsync with your content and a trigger like DAILY, WEEKLY or DATE. Here is every trigger type, how to cancel and list what is scheduled, why Android reminders arrive late, and a Claude Code prompt that builds the whole reminder flow.

David 8 min
Read article

Ready to build it yourself?

Join App Store Launch Club, the #1 community for building and launching apps, for $9/month.

← Back to the blog