Best Practice for Storing User Session


#1

So I would like to store a user session everytime someone is logged into my app. I will need to pull information about the user on different pages throughout the application. What is the best practice in going about this?

I know how to make a provider that would just talk to my localStorage, but I wasn’t sure if there is a better, more ‘proper’ way to do this…


#2

Use Ionic Storage, not local Storage. And a provider is the standard way to do it.


#3

Have you thought about using a JWT?

See:


#4

When do you think it’s worth it to code up the JWT? That code by @rapropos in the last link is probably excellent, given his usual standard. But it’s a lot more than the two lines or whatever to use SQLite.


#5

Most Apps have a back-end (e.g., a RESTful API) and a front-end (e.g., a Hybrid Mobile App).

And, if you want your solution to scale out then your back-end will support JWTs, so it makes sense for your front-end to follow the same approach.


#6

Okay cool I was planning to use JWTs down the road so I’ll do that now. But when using JWTs, I still store them using Ionic Storage right?