[Solved] How to maintain user session after exiting app

Hi, I would like to maintain the user session even after a user closes the App. if I logged in my application on my mobile, it should always be logged in whenever I try to access that application. I don’t Know how to start… Now, when the user do the login I store the email and the password in a local variable in my-app.js. Then I check with a request to my API if the user has the permission and then I show him the index…. but If the user close the app and then start it again I have to do the login. It’s not a good behaviour

Thank you in advance

You should store the details in the local storage. I personally use jStorage.

During the start of the App you read the data from the previous Session.

But I highly recommend not to store the passwd itself but a hashed value with some salt. If you need the e-mail (passwd recovery) it should be stored encrypted. In my app I stored the information (hashed /encrypted,) only on the server and returned a token back to the app as reference to the account.

Best regards
Andreas

1 Like

Hi Andreas,

I am looking to secure the login details and like to know you used to encrypt the login credentials in the app. Any help is appreciated.

Thanks

Please don’t ask same question in multiple posts

1 Like