expo: EAS build: SecureStore returns null for all keys after upgrading to a binary built with EAS
Summary
I have a production build of my app built with SDK version 38 using expo build
. I am upgrading my app from SDK version 38 to 44 along with a bunch of changes.
If I build the app with eas build
and release the application in TestFlight or for internal testing in Google Play, the app no longer has any access to the previous information stored in SecureStore. They return null.
However, if I build the app with expo build
and release it, the app has access to the information.
Managed or bare workflow? If you have ios/
or android/
directories in your project, the answer is bare!
managed
What platform(s) does this occur on?
Android, iOS
SDK Version (managed workflow only)
44
Environment
Expo CLI 5.0.3 environment info: System: OS: Windows 10 10.0.22000 Binaries: Node: 14.17.0 - C:\Program Files\nodejs\node.EXE Yarn: 1.19.2 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 6.14.13 - C:\Program Files\nodejs\npm.CMD npmPackages: expo: ^44.0.0 => 44.0.5 react: 17.0.2 => 17.0.2 react-dom: 17.0.2 => 17.0.2 react-native: 0.64.3 => 0.64.3 react-native-web: 0.17.5 => 0.17.5 react-navigation: 4.4.4 => 4.4.4 Expo Workflow: managed
Reproducible demo
- Create a new app that uses SecureStore
- Build the application using
expo build
- Publish the application to TestFlight or Google Play (a simple apk installation might suffice) and install it on a device
- Store something to SecureStore
- Build the application again using a different version code with
eas build
- Install the new version to the device
- Try to get the information stored in previous version, it returns null
- Downgrade the version
- Confirm that again, you do have access to the information stored
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 8
- Comments: 20 (1 by maintainers)
Just add the following into your app.json: “ios”: { “entitlements”: { “keychain-access-groups”: [“XXXXXXXX.*”, “com.apple.token”] }, }, where XXXXXXXX is your apple “Team ID”. How to find out your Team ID? Login to App Store Connect, click on your name (right top corner), then “Edit Profile” and it’ll take you to a screen that will have “Team ID” on it.
Another way to see/check this is go to your app in App Store Connect -> TestFlight tab -> pick a build -> Build Metadata and at the bottom there’s Store Information section that has “Entitlements”. You should see "keychain-access-groups: ( “XXXXXXX.*”, “com.apple.token” ).
Hope it helps.
Hi @dhcmega, the issue is still persisting on my end. I am still waiting for a response from expo staff.
@martin-ecatch thank you for writing all this up. This was extremely helpful for us having the same issue.
Update: my suspicion was correct. Adding the missing keychain-access-groups into app.json (in ios -> entitlements) fixed it. This is an easy workaround. It’s a bug in eas build + SecureStore that should probably be addressed… Anybody able to fix it in expo and submit a PR for that?
@animaonline you mean that the issue still happens after you apply the workaround that Martin came up with? If so, you may want to run
eas config
and verify that your entitlements are set up with the correct values.I confirm @martin-ecatch solution ! Thank you so much !