Angular2 - App with login and remember user

Viewed 5102

I'm trying to write an application in Angular 2 (final version) with login and remember user functions. I tried to understand the principle of this.

1- The user enter his login and password and click on connect

2- Angular2 request on webservices with user login and password

3- Webservices creates a token and store it in the db

4- Web services send it back to the front.

But what the front does with the token ? Does it store it in localStorage ?

RememberMe:

I've read this topic What is the best way to implement "remember me" for a website?

I understood that we need a token and check on each page if this token is present in cookies and if it's the same in db.

But is it a different token than the one for the login ? Do I store it in the localStorage, sessionStorage or as a cookie ?

Do someone can explain all of this clearly to me ? Or if you have any clear topic, tutorial or application code understandable I would be very pleased.

1 Answers
Related