realm-java: SyncUser.currentUser is not cleared on log out
Logging out doesn’t seem to clear the current user. This makes it very hard to switch users. I had to manually remove the signed out user from the SyncManager user store to get sign out/switch user to work as expected. Are you supposed to have to do this manually? In the realm tasks app, the current user is ignored when switching users, which seems like a workaround too.
I am using full synchronziation for my realm if that helps
Code Sample
SyncManager.addAuthenticationListener(object:AuthenticationListener{
override fun loggedOut(user: SyncUser?) {
SyncManager.removeAuthenticationListener(this)
user?.let {
//Without this line SyncUser.currentUser() will not return null even though the user has bee
// signed out
SyncManager.getUserStore().remove(user.identity, user.authenticationUrl.toString())
}
signOutFromMyOwnAuthSystemAndRestartApp()
}
override fun loggedIn(user: SyncUser?) {}
})
SyncUser.current().logOut()
Version of Realm and tooling
Realm version(s): 5.2.0
Realm sync feature enabled: yes
Android Studio version: 3.1.3
Which Android version and device: Nexus 5x
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 17 (6 by maintainers)
Closing as this is related to legacy sync.