简体   繁体   中英

Secure method of saving credentials in Android

I'm developing an Android app. For authentication the user needs to enter the user name and password and the server returns an expiring authentication token.

Currently I'm saving the token but not the credentials. What is the preferred safest method to save the credentials locally so that when the token authentication fails I can re-login the user using the saved credentials in the background without having the user to enter their credentials again.

I'm aware of saving data using SharedPreferences. But are they really secure? Can I use AccountManager for this purpose?

Having a background service that when the token expires would login the user again automatically would not be very secure.

Is it not possible to make the expiry time of the told longer? As saving the credentials and trying to login periodically would not be very secure.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM