I have implemented a HTTP auth sign up/login utilizing JSON Web Tokens (https://github.com/sahat/satellizer) where the token is saved in local storage after authentication. However, I have discovered after I emulate and build the app on my iPhone, go ahead and login, and then close the app, the user’s login session is destroyed.
Is local storage preserved when a user closes the app? Have I made a possible oversight in my technical implementation? How can I go about keeping a user logged in once they’ve closed the app?
In these link most options describes, which might help to you.
If you want to use local storage then used as follow.
set variable in your login controller with local storage and if you want them used in entire application then defined such variable in factory file.
Set Local storage variable :
localStorage.setItem("var_1",value1); localStorage.setItem("var_2",value2); and so on.
Get variable value in app.js file and check whether the login details like username, password, auth token and other information available or not :
localStorage.getItem("var_1"); localStorage.getItem("var_2"); and so on.