Storing Credentials in Local Storage

后端 未结 4 1562
陌清茗
陌清茗 2020-12-15 04:13

Could I securely use local storage instead of cookies to store session credentials?

Would I need to store an encrypted hash??

EDIT: Would this be secure eno

4条回答
  •  死守一世寂寞
    2020-12-15 04:36

    You server shall generate some token - unique (for the server) piece of data that cannot be used to discover username/password. Only that token can be stored on user's machine in any form. Neither localStorage nor cookie are secure. So the same rules applied to them in this respect.

    You should have some means to expire such token otherwise once stolen such token can be used instead of real credentials.

提交回复
热议问题