Storing authorization token in Android application

Hi

It would be great if I could store the authorization token received from the server after a successful user login, so the user don’t have to login every time they start the app.

Best regards

Now I store the email and the password encrypted in the SharedPreferences, but I want to avoid storing the password for many reasons. A good way to solve this problem would be an authorization token which I could store locally and log in with that till its valid and ask the user for credentials only if the token is expired.

How about using the local storage on the device to save some state of your app (like user object) indicating that the user has successfully logged in? Next time the app starts, just check if you have that saved state in there, and if you do, retrieve the user object from the local storage and perform the login in the background.