How to keep the user logged in as long as he didn't log out

i’ve been trying to understand the way to implement that.keep a user logged in as long as he didn’t log out.found ng-storage,localstorage .first of all what’s the difference between those 2 things?i understand that they are modules.but which one is more convenient to a mobile app to achieve what i want?i believe using ng-storage will be the move because it has sessionstorage
thank you

if you want to store information even if the app is closed or phone is restarted, you need to use localstorage. It will keep your data until user clears the data or App is not uninstalled.

give code for example

i don’t have any code yet.i made some tests using a counter like in the github page of ngstorage.i was just trying to figure it the difference between the things i mentioned from @baviskarmitesh i know ineed to use localstorage