Cloud Platform Logout Problems


I am having problems with LogOutAsync (on Xamarin). I call it when the user logs out, there are no errors, and everything appears fine. If I then log back in with the same user, there are no problems. However, if I try logging-in with a different user, I get the following error when trying to do any subscription on the instance:

Realms.Exceptions.RealmException: Current user is not valid if more that one valid, logged-in user exists.

I have to fully delete the app from the device in order to log in and subscribe as a different user. Is there something I am missing? Is the logout failing silently? Is there some cache or similar that I need to clear?

Thanks in advance!


As an additional note, after a failed login by User 2, trying to log in as User 1 again works no problem. So it definitely seems to be a state/cache/etc issue with User 1 not being cleared on logout.


@bsohl Sounds like the logOut is not completing successfully. Yes the login is cached after the first successful login - this is to allow offline login. You can use the User.allLoggedIn array to see a list of all the current logged in users, find the right user, and login with that one.


This is from a typical login form where the user enters a username/password. The user has possibly never logged in on the device before. I’m not sure the User.allLoggedIn array would be applicable?

Common use case is that I need to borrow someone else’s device. They sign out from the app, and then I try to sign in with my account.


I’m not sure the User.allLoggedIn array would be applicable?

If the array has multiple entries it would be a good way to test if logOut() is working.


Ah, gotcha. I’ll take a look and see what’s there.


Ok, so User.AllLoggedIn.Length is 0. If I try to sign in with a different user, it hangs on the first subscribe. Auth is entirely successful, just a 100% consistent hang on the first subscribe. Signing back in with same user succeeds without issue.

I have another topic open on random hangs on subscribe that I am getting in general. This one is 100% though. The other hangs will usually resolve after a timeout and retry.

Any ideas?


@bsohl Sounds strange - are you able to share a small reproduction case and open a ticket at

Please reference this forums post when you open the ticket