I've been reading a lot of threads and decided to to post my conclusion before going on coding. I've found a lot of interesting things (What is the most appropriate way to store user settings in Android application) and this is what I have gathered so far :
We'll suppose that https is always used.
By "remember me", I mean the following : the user will never authenticate on the app ever again because it would annoy him to authenticate even once a week.
When not using a "remember me" feature : Oauth2 is the way to go, exchange tokens are used -> nothing gets stored, most secure
When using a "remember me" feature :
Upon first Register/user/login usage of the app : Password is hashed by server with its own "private key"/hash and returned to android.
This hashed password is then encrypted before being stored inside SharedPreferences. Given the Hashed password never expires, we now have the following caveats :
- If the phone is lost/rooted, only this hash can be retrieved to access user's data on the server : user's data is compromised.
- The crypting key is stored inside code which can be decompiled : : user's data is also compromised. Since attacker can uncrypt the hashed password and use it.
Conclusion : Using a "remember me" feature, while handy for the user, makes it vulnerable.
My question (at last :) ) Is this conclusion correct ? Did I forget an obvious solution ?
I cannot find any safer solution given the constraints (no expiry, use remember me feature)
Thank you for your help !