In my app, users have the option to delete their account. This will call a Realm function that deletes the user account with all associated data. The problem is, after calling this function, any Realm related call will result in an
invalidSession error, which is normal since the local cached user does not exist anymore — I need to log out the user.
I tried calling
currentUser.remove() right after the call to the delete function, but both result in an
invalidSession error. So, how can I “reset” the session and remove everything related to the old user, to that the app is in a new state, ready for another login?