How to secure login and user in angular -


i new in angular 2 try create login user in front site question how secure user login. have implement store user login token cookies in browser , page it's right way ?

 this.loginservice.login(this.user)       .subscribe(result => {           if (result != undefined ){                this.cookieservice.putobject("logincookie", result);                this.router.navigate(['/userlist']);           } 

the preferred way use localstorage.

this.loginservice.login(this.user)   .subscribe(result => {       if (result != undefined ){            localstorage.setitem("username", result);            this.router.navigate(['/userlist']);       } 

you should store username in localstorage not password security purpose.

you can prevent user navigate without login using authguard. detailed explanation of authguard here.


Comments

Popular posts from this blog

html - How to custom Bootstrap grid height? -

javascript - pass values from mssql to views in node -

javascript - Understanding ExtJS Framework Syntax -