In the App we are passing UserName
value to a Internal API
.
Before making a Ajax
call to API
, I am calling a function named GetUserName()
like below. This function basically stores username in a cookie. I don't want to always make Ajax
calls to server to get the UserName.
Code:
function GetUserName()
{
//TODO
1. If UserName Cookie exist, return it.
2. If UserName Cookie doesn't exist, then make Ajax call to server to Get
UserName and set the Cookie.
}
As said here storing username and password in client side is bad practice.
But would like to know is it bad practice to store just username in a cookie for this scenario ? Or should I encrypt the UserName
?
Any help would be great.