delight-im / Android-DDP

[UNMAINTAINED] Meteor's Distributed Data Protocol (DDP) for clients on Android
Apache License 2.0
274 stars 54 forks source link

Upon automatic re-connect after a connection outage, a failure to automatically log back in does not update mLoggedInUserId and the Meteor class will therefore still think you are logged in #23

Closed joshuaswett closed 9 years ago

joshuaswett commented 9 years ago

To replicate this issue, log in to the same user account with two different devices (one being an Android device using Android-DDP). Configure your logout to use the Meteor.logoutOtherClients() method which will log out all devices for a certain account when one of the devices logs out. Now, log out on your account on the non-Android device. Due to the logout configuration stated above, the logout on the non-Android device will cause the Android device to be logged out. When the Android device gets logged out, its DDP connection is lost and the Android-DDP library gracefully re-establishes the connection. However, the login token is no longer valid and Android-DDP can't automatically log the Android device back in. In this circumstance, the mLoggedInUserId field is not cleared and the Meteor class will still return true when isLoggedIn() is called.

ocram commented 9 years ago

Thank you so much!

Please see the following commit: https://github.com/delight-im/Android-DDP/commit/8f95c38f47fdcd12f644cf953205401675655530

I've incorporated your fix in a new commit because I thought it would fit into that callback even better -- and the token should probably be cleared as well :)

Does that make sense? Does it work as intended now?

joshuaswett commented 9 years ago

Your commit looks good, and I agree that that is a better spot for the logic. Thanks for getting that in there! It works as intended now.