Ionic => Expo: Need help retrieving auth tokens on app update

#1

I currently have an ionic app in production where I store auth tokens in two places: local storage & an sqlite databases in the “/data/data/com.my-app-name.app/databases/my.db”.

When users update the app from ionic to expo, I would like their sessions to persist, but I cant find a way to access the prior tokens from Expo.

I tried accessing the old local storage by adding a webview that points to an index.html in my assets directory. It runs some javascript which reads local storage, but local storage is empty. This is because index.html gets served out by Expo’s cdn, so the domain is different. I added it to my app.json’s assetBundlePatterns field, but that didn’t make a difference.

I tried using Expo’s sqlite to access the preexisting database, but the sqlite api points to a different directory than /databases/.

Any ideas?

#2

hi there! it’s not currently possible to access files outside of the scoped app directory that expo uses at the moment. this does seem potentially useful for situations like what you have encountered, where you want to migrate from an existing app built with other tools to an app built with expo.

i created a feature request to track this: https://expo.canny.io/feature-requests/p/provide-path-for-migrating-data-from-existing-app-to-app-built-with-expo

1 Like
closed #3

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.