Search code examples
react-nativeasyncstorage

Is AsyncStorage permanent?


I am storing my app's auth token in AsyncStorage. It appears that both on Android and iOS (less sure about this one), after long periods of inactivity (~2 weeks), users are logged out. I am sure that it doesn't have to do with the server.

Is AsyncStorage permanent?

EDIT: Well, that's embarrassing. The problem was on the server, and it wasn't AsyncStorage's fault.


Solution

  • From the RN docs https://facebook.github.io/react-native/docs/asyncstorage.html

    On iOS, AsyncStorage is backed by native code that stores small values in a serialized dictionary and larger values in separate files. On Android, AsyncStorage will use either RocksDB or SQLite based on what is available.

    Both the databases and the files sound permanent to me. Maybe your users are clearing your app's cache or local files somehow?