Skip to the page

Mobile security · core

Secure storage, tokens and biometric login

Keep secrets out of plain storage: refresh tokens go in the iOS Keychain or Android Keystore-backed storage (react-native-keychain, expo-secure-store), access tokens stay short-lived in memory, and biometrics should unlock a protected Keychain/Keystore item rather than just return true or false.

The notes

What you must know

  • AsyncStorage, unencrypted MMKV and redux-persist files are readable on a rooted or jailbroken phone or from backups.
  • Keychain (iOS) and Keystore (Android) keep keys in system-protected, often hardware-backed storage. expo-secure-store uses the Keychain on iOS and Keystore-encrypted SharedPreferences on Android; keychainAccessible defaults to WHEN_UNLOCKED.
  • Lifetime: on Android, secure-store data is deleted on uninstall; on iOS, Keychain items can survive a reinstall (clear them on first launch if you need a clean start). Exclude secure data from Android Auto Backup.
  • Biometrics: expo-local-authentication or react-native-biometrics, or better, store the secret with requireAuthentication so the OS asks for Face ID / fingerprint before releasing it. A plain "authenticate() → true" check can be bypassed by hooking on a rooted phone.
  • iOS needs NSFaceIDUsageDescription; Face ID does not work in Expo Go.
  • Accidental leaks: logs, crash breadcrumbs, analytics events, screenshots, deep-link URLs, persisted Redux. Scrub them.
  • Secure storage raises the cost of an attack but cannot beat a fully compromised device; pair it with short token lifetimes and server checks.

The red pen

Common traps: mistake → fix

  • Mistake: "Encrypt with a key written in JS"

    Fix: the key ships inside the bundle.

  • Mistake: "Biometric success means the user is authenticated"

    Fix: tie biometrics to a Keychain/Keystore item or a server challenge.

  • Mistake: "Keychain data disappears on uninstall on iOS"

    Fix: it can survive; handle it.

Easy to hard

Questions interviewers ask, easy to hard

  1. Where do you store auth tokens, and why not AsyncStorage?
  2. Should the access token be stored at all?
  3. Implement biometric login. What exactly does the biometric check unlock?
  4. What leaks tokens by accident?

Practise

Practise with these questions

Explain it out loud

Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.

Practise by voice

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview