Storing Credentials in Local Storage

后端 未结 4 1561
陌清茗
陌清茗 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:56

    If you're going to use localStorage instead of cookies, you can make things more secure than cookies. That's because you don't need to send a session id to the server with each request, making it a bearer token. Instead, you can store a user secret on the client side in localStorage, and use it to sign your requests in addition to the corresponding public key being sent down and used as the session id. This way, no one on the server side or proxy can fake your requests.

提交回复
热议问题