I read from this post that the best way to authenticate a user to a custom service is to use token-based authentication: send username and password for the first time and retrieve the token from the server. But I did not understand some details of this process:
- What period of time should the token be valid?
- How to store the token on the mobile device (SQLite, file; encrypted or not...)
- When the token expires, the user will have to authenticate himself again but isn't that behavior annoying. We could do silent authentication but to do that we need to store user password on device what is not correct.