Get Started
API Reference


expo-secure-store provides a way to encrypt and securely store key–value pairs locally on the device. Each Expo project has a separate storage system and has no access to the storage of other Expo projects. Please note that for iOS standalone apps, data stored with expo-secure-store can persist across app installs.
iOS: Values are stored using the keychain services as kSecClassGenericPassword. iOS has the additional option of being able to set the value's kSecAttrAccessible attribute, which controls when the value is available to be fetched.
Android: Values are stored in SharedPreferences, encrypted with Android's Keystore system.
Size limit for a value is 2048 bytes. An attempt to store larger values may fail. Currently, we print a warning when the limit is reached, but in a future SDK version, we may throw an error.

Platform Compatibility

Android DeviceAndroid EmulatoriOS DeviceiOS SimulatorWeb
  • This API is not compatible on devices running Android 5 or lower.


→ expo install expo-secure-store

If you're installing this in a bare React Native app, you should also follow these additional installation instructions.

import * as React from 'react';
import { Text, View, StyleSheet, TextInput, Button } from 'react-native';
import * as SecureStore from 'expo-secure-store';

async function save(key, value) {
  await SecureStore.setItemAsync(key, value);

async function getValueFor(key) {
  let result = await SecureStore.getItemAsync(key);
  if (result) {
    alert("🔐 Here's your value 🔐 \n" + result);
  } else {
    alert('No values stored under that key.');

export default function App() {
  const [key, onChangeKey] = React.useState('Your key here');
  const [value, onChangeValue] = React.useState('Your value here');

  return (
    <View style={styles.container}>
      <Text style={styles.paragraph}>Save an item, and grab it later!</Text>
      {%%placeholder-start%%Add some TextInput components... %%placeholder-end%%}

        onChangeText={text => onChangeKey(text)}
        onChangeText={text => onChangeValue(text)}
        title="Save this key/value pair"
        onPress={() => {
          save(key, value);
          onChangeKey('Your key here');
          onChangeValue('Your value here');

      <Text style={styles.paragraph}>🔐 Enter your key 🔐</Text>
        onSubmitEditing={event => {
        placeholder="Enter the key for the value you want to get"

%%placeholder-start%%const styles = StyleSheet.create({ ... }); %%placeholder-end%%const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    paddingTop: 10,
    backgroundColor: '#ecf0f1',
    padding: 8,
  paragraph: {
    marginTop: 34,
    margin: 24,
    fontSize: 18,
    fontWeight: 'bold',
    textAlign: 'center',
  textInput: {
    height: 35,
    borderColor: 'gray',
    borderWidth: 0.5,
    padding: 4,

import * as SecureStore from 'expo-secure-store';

Type: KeychainAccessibilityConstant

The data in the keychain item cannot be accessed after a restart until the device has been unlocked once by the user. This may be useful if you need to access the item when the phone is locked.

Type: KeychainAccessibilityConstant

Similar to AFTER_FIRST_UNLOCK, except the entry is not migrated to a new device when restoring from a backup.

Type: KeychainAccessibilityConstant

The data in the keychain item can always be accessed regardless of whether the device is locked. This is the least secure option.

Type: KeychainAccessibilityConstant

Similar to ALWAYS, except the entry is not migrated to a new device when restoring from a backup.

Type: KeychainAccessibilityConstant

Similar to WHEN_UNLOCKED_THIS_DEVICE_ONLY, except the user must have set a passcode in order to store an entry. If the user removes their passcode, the entry will be deleted.

Type: KeychainAccessibilityConstant

The data in the keychain item can be accessed only while the device is unlocked by the user.

Type: KeychainAccessibilityConstant

Similar to WHEN_UNLOCKED, except the entry is not migrated to a new device when restoring from a backup.

Delete the value associated with the provided key.

  • Promise<void>

A promise that will reject if the value couldn't be deleted.

Fetch the stored value associated with the provided key.

A promise that resolves to the previously stored value, or null if there is no entry for the given key. The promise will reject if an error occurred while retrieving the value.

Returns whether the SecureStore API is enabled on the current device. This does not check the app permissions.

Promise which fulfils witch boolean, indicating whether the SecureStore API is available on the current device. Currently this resolves true on iOS and Android only.

  • key (string) - The key to associate with the stored value. Keys may contain alphanumeric characters ., -, and _.
  • value (string) - The value to store. Size limit is 2048 bytes.
  • options (SecureStoreOptions) - An SecureStoreOptions object.

Store a key–value pair.

A promise that will reject if value cannot be stored on the device.

KeychainAccessibilityConstant(iOS only) Specifies when the stored entry is accessible, using iOS's kSecAttrAccessible property. See Apple's documentation on keychain item accessibility. Default value: SecureStore.WHEN_UNLOCKED.
  • iOS: The item's service, equivalent to kSecAttrService
  • Android: Equivalent of the public/private key pair Alias
If the item is set with the keychainService option, it will be required to later fetch the value.