Implementing login system with ionic


#1

Hi there. I am going to implement a login system by ionic framework. I searched a lot and found some solutions, but not sure about them.
First one: In login form, send request to server and get user_id and store it in localStorage and validate user by that. There is a solution about that here. Is this a good way?
Second one: Use a login system based on token. There is an article about this here. But this one is a bit complicated.
Which one is better? Or any other ways?


#2

The token system of course. It’s how it should be done.


#3

As @Gajotres said, it’s always good to use token based authentication. You can try using the JWT token based authentication, which has lots of features.


#4

use token way all the way … especially when you do a read/write request, always make sure you supply the token and validate on your server