5

I am creating Progressive-web-app application ,I want to store user information in local device. So, how can i do this.how can I store user login information,so that he does not have to login again and again

Palak Jain
  • 93
  • 1
  • 5
  • Possible duplicate of [Local Storage vs Cookies](https://stackoverflow.com/questions/3220660/local-storage-vs-cookies) – Michael Shopsin Feb 15 '18 at 13:32
  • set the cookie expire time for longer period like 1 year or 2 year. So that user will be logged out after a longer period which will feel like they are always logged in. And if you are looking for store data like sqllite, you can use indexeddb. check this out article for more help on how tostore data - ujjwalguptaofficial.blogspot.in/2017/10/angular4-crud-operation-in-indexeddb.html – Ujjwal Kumar Gupta Feb 15 '18 at 14:49

1 Answers1

4

There's no SQLite for browsers, the closer you can achieve is using IndexedDB or localStorage.

I'm assuming you're using JWT or any other token authentication based tool/library, so just save that token and when the window load you'll check if the token is present and still valid, if so you can redirect the user to a desired page or let him navigate, the logic is up to you, but these are the two options you have.

Hope this helps.

Gabriel Barreto
  • 6,103
  • 1
  • 22
  • 45