Monday, 22 May 2017

Logout session Angular2 nodeJS

I have an Angular2 application and NodeJS server. I got stuck on implementing logout. If I simply use req.session.destroy(), it does not have affect on the Angular2 side. Angular2 still thinks that user is logged in. (because when I call a method which returns data about logged in user, it still returns it - even though it needs req.session.user to return this data). I saw some solutions for this problem, but all I saw was using localStorage (saving user in localStorage and then deleting it after clicking logout).

Is there any other more efficient way to tell Angular2 from NodeJS that the user has logged out and that the session has ended?



via squirrel

No comments:

Post a Comment