0

令牌如何存储在本地存储和会话存储中 如何生成令牌以及哪个对于管理员用户身份验证是安全的 对于 Angular 应用程序的角度身份验证 使用令牌存储的角度身份验证与浏览器或应用程序中的会话存储一样安全

4

2 回答 2

0

根据我对 JWT、本地/会话存储和您的问题的理解,使用会话存储来存储 JWT 将是理想的,因为会话存储对于每个浏览器选项卡都是独立的。开发人员以这种方式管理令牌更容易。

在安全性方面,考虑到 JWT 是短暂的,本地和会话存储都应该没问题。

于 2021-03-06T02:08:24.700 回答
0
Local storage is a new feature of HTML5 that basically allows you (a web developer) to store any information you want in your user’s browser using JavaScript. 
In practice, local storage is just one big old JavaScript object that you can attach data to (or remove data from). 
Example:
// Considering it as a object
localStorage.userName = "highskillzz";
//or this way!
localStorage.setItem("objects", "0");

// Once data is in localStorage, it'll stay there forever until it // is removed explicitly 
console.log(localStorage.userName + " has " + localStorage.objects + " number of objects.");

// Removing data from local storage is also pretty easy. Uncomment 
// below lines
//localStorage.removeItem("userName");
//localStorage.removeItem("objects");

It was designed to be a simple string only key/value store that developers could use to build slightly more complex single page apps. That’s it.
于 2018-09-03T08:35:03.780 回答