State your question
I am currently facing a weird issue using the AWSMobileClient SDK on iOS. The scenario is as follows:
AWSMobileClient.initialize() recognises the user as already logged in.-> It seems the cached tokens are not removed when the application is uninstalled. Could this be the case ?
Which AWS Services are you utilizing?
Provide code snippets (if applicable)
Environment(please complete the following information):
Device Information (please complete the following information):
Hi @alexanderwe,
This is expected behavior. AWSMobileClient caches its credentials in the Keychain, which is Apple's recommended way to store secure data. The Keychain is a shared system resource that persists across app installs, so when the user re-installs the app, AWSMobileClient is able to restore credentials from the Keychain.
If you wish to avoid this behavior, you can have a "firstSignIn" flag that you persist in some store that is cleared on app uninstalls (e.g., UserDefaults), and check for the existence of that flag on app startup. If the flag doesn't exist, you can force a signout with AWSMobileClient.signOut() before proceeding with app startup.
Hope this helps.
@palpatim Thanks a lot for your fast response ! I already thought it would be something like this, but I was unaware of the fact, that the keychain items are persisted even if the app is uninstalled.
I tested your recommend workaround and it works fine. Thanks for pointing me in the right direction.
Closing this ticket, since my question is answered.
Most helpful comment
Hi @alexanderwe,
This is expected behavior. AWSMobileClient caches its credentials in the Keychain, which is Apple's recommended way to store secure data. The Keychain is a shared system resource that persists across app installs, so when the user re-installs the app, AWSMobileClient is able to restore credentials from the Keychain.
If you wish to avoid this behavior, you can have a "firstSignIn" flag that you persist in some store that is cleared on app uninstalls (e.g., UserDefaults), and check for the existence of that flag on app startup. If the flag doesn't exist, you can force a signout with
AWSMobileClient.signOut()before proceeding with app startup.Hope this helps.