I have this line to check if the current user is admin or normal user
if (this.responseData.user.appUserRole === 'ADMIN') {
//.......
} else {
//......
}
it's safe to store value like isAdmin in local storage? or there is another way to put in variable to use it another place?
CodePudding user response:
Depends... for example is the site vulnerable to XSS attack local storage is a not safe place to save user credentials in general.
The other reason is that people can clear their cache. In some cases in my opinion is better to save this information directly using cookie.
I hope that my explanation is clear