Let's assume the application need to store multiple user accounts and to be able to switch between them without re-login. Just like in any Mail app, etc. What is the best approach for achieving this?
To be specific: users should be logged in using OAuth mechanism via Authentication Manager (). In order to store and use multiple users credentials in the keychain, I'm using enableAutoSyncToKeychain(withIdentifier: , accessGroup:, acrossDevices:) method call with unique keychain identifier for each user. It works fine but with limitations to switch between stored user credentials.
While switching between accounts, calling AGSAuthenticationManager.shared().credentialCache.disableAutoSyncToKeychain() and than AGSAuthenticationManager.shared().credentialCache.enableAutoSyncToKeychain() with a keychain identifier for new user doesn't perform the trick and mess things up.
Also, setting the portal.credential to nil doesn't help. The application still have access to the user specific data. Looks like credentials in some way cached in the RAM. So the only way to actually switch between stored user credentials I've found so far, is to recreate the AGSPortal object from scratch and to call .enableAutoSyncToKeychain() with new identifier after.
To summarise: is it possible to switch between user/credentials_in_keychain without recreating AGSPortal object? Or what is the suggested way of achieving work with multiple accounts using SDK?