Вопрос

Hello i have an application which all activities can be reached after login (like facebook) I want to write work flow

Status: launch application first time Login screen-> get username and pass -> check from db -> if true save username and pass to sharedpref -> mainactivity

Status: closed application without logout and restart Login screen-> get username and pass FROM SHAREDPREFERENCES -> check from db -> if true save username and pass to sharedpref -> mainactivity

I want to jumpover check from db step Is it safe to set application "if username and password are in sharedprefereces directly show mainactivity because you have also checked and saved to sharedpref"?

Это было полезно?

Решение

You need to account for the account being deleted or the password being changed, so no that will not work.

The best way to save a user's credentials is to implement a token system like OAuth on your server, and store the token instead of the username/password.

If you can't modify the server, then your best bet is to store username and an encrypted password, and authenticate with the server every time the user opens the app.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top