DEV Community

AjayMalhotra
AjayMalhotra

Posted on • Edited on

local storage Use

Hello dev,
I am making an application using Angular 6 and laravel and I need help for store session data and I read to many articles and Most of articles suggest LocalStorage.
https://therichpost.com/best-practice-for-localstorage-in-angular
I want to know, is it good to store data like session data or I need to use something else?

Thank you
Therichpost

Top comments (6)

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀 • Edited

May I suggest indexdb via pouchdb framework. Please consider reading this excellent dev.to post on the subject.

Article: Linky

Pouchdb: pouchdb.com

Collapse
 
ajaydeveloper profile image
AjayMalhotra

Good information.

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀 • Edited

Been in your shoes, only difference, I wasn't brave enough to ask. That post should help you weigh it up. I have sebtled on encrypted user data stored in index dB but making sure it invalidates on browser close. Anything else like names and credit cards I'd store in Couch server side then sync.

Thread Thread
 
ajaydeveloper profile image
AjayMalhotra

Can I use local-storage to use usernames.
I also heard session storage kind of thing in JavaScript.
Anyways thank you

Thread Thread
 
adam_cyclones profile image
Adam Crockett 🌀 • Edited

Depends,

Are the user names email addresses?

by allowing usernames to be stored, you make the attackers job easier by doing 50% of the work for them. however, if when you auth, you have 3 credentials. username, date of birth (dont use this its easy to get DOB) and password then you could store usernames with no real impact?

Thread Thread
 
ajaydeveloper profile image
AjayMalhotra

Okay good