I have a ReactNative app (only published for iOS) which uses ExpoSecureStore to put and read values from iOS Keychain.
I am transitioning to Flutter and I need to keep the users logged in, i.e. to get their auth tokens from the previously installed RN version of the app.
So, here is what I do:
- I install the RN app from the App store,
- Log in (the token is saved with ExpoSecureStore),
- Install my Flutter app
- Try to access the Keychain - nothing found!
- Reinstall the RN app from the App store,
- User is logged in when I open the app!
So, my Flutter installation doesn't delete the tokens, but it can't access them.
Update 18.3.2020.
Here is what ReactNative's latest build looks like on AppstoreConnect:
Here is the same info for our Flutter build:
I tried setting the keychain group in Flutter's XCode project to all kinds of values: TEAM_ID.*
, TEAM_ID.
, TEAM_ID
, *
, TEAM_ID.com.my_real_app_id
etc.. but nothing helped
Is there something I am missing?
============== original question continues ================
I am using the FlutterSecureStoragePlugin
(link to the .m
file) to access the Keychain values.
Here is the link to the EXSecureStore.m
file - EXSecureStore.m on GitHub.
The Flutter app has the same bundle ID, so that should not be the problem.
I've changed its source code so that I use the same keychain service (
kSecAttrService
), which defaults to"app"
.Also, I've copied and adapted the code for reading the Keychain values from
ExpoSecureStore.m
toFlutterSecureStoragePlugin.m
but still no luck..
Could there be any difference in the way RN and Flutter libraries pass strings down to native iOS? I guess there must be something going on with the Keychain access that I don't know, so any help is very welcome!
Thank You for reading!
ExpoSecureStore.m
. I mentioned it in the last item of the unordered list in the question. I think there must be something hidden in the storing process I'm missing.. – AleksandarKeychain Sharing capability in Xcode
. here you can find more information about it. – Reza DehnaviKeychain access groups
. Having at least one value in that array inside the entitlements file automatically enables it. – Aleksandar