According to MDN, it is assumed that it is more secure than cookies to store persistent data on the client.
Taking a quick look at the Facebook cookie, for example, I see things like userid, authentication tokens, chat presence indicator and window size. (Do not post my cookie here for obvious reasons).
The function that makes cookies โless secureโ (cookies are sent with an HTTP request) is the function that they need in this case, because it is part of their communication protocol. Authentication identifiers are useless if they are not sent to the server, as well as authentication.
Simply put, they do not use localStorage in this case, because they are not trying to store things locally.
source share