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

How to keep user logged in? #15

Closed iahvector closed 9 years ago

iahvector commented 9 years ago

How to keep a user logged in or log him automatically without saving his password? I noticed that the login request returns a token. Can't this be used?

ocram commented 9 years ago

Yes, that token can be used. Thank you!

The latest version of this library should now support automatic login with the help of that token.

In order to update, please proceed as follows:

  1. Get the latest JAR from this repository and include it in your app
  2. Replace all occurrences of new Meteor(...) with new Meteor(this, ...) in your own code
  3. Replace all occurrences of void onConnect() with void onConnect(final boolean signedInAutomatically) in your own code
  4. Only perform the login manually if the parameter signedInAutomatically is set to false

Does that work?

iahvector commented 9 years ago

Yes, Thanks. Can you please add methods to check if a user is logged in, get logged in user ID and logout?

ocram commented 9 years ago

@iahvector Please get the updated JAR again and use the methods mMeteor.isLoggedIn(), mMeteor.getUserId() and mMeteor.logout(). Thanks!