A
A
Alexey2017-09-27 12:06:26
Angular
Alexey, 2017-09-27 12:06:26

What is the principle of passport.js authentication in Angular 2 spa app?

Good afternoon.
I am mastering node.js , namely at the moment - authentication using passport.js . For me, the theme of SPA is relevant .
After digging around in google , I came up with this option:
- on the front in Angular 2 in the route, I can use CanActivate and check the user's cookies there (whether logged in or not) - when going through the routes
- on the server using passport , I can check whether the user is logged in or no - when processing a rest request
Those. check to carry out "both there and there". Is this really the case or are there other more unified and optimal approaches?
Thank you in advance!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question