首页 文章

使用JWT令牌会话存储与本地存储进行身份验证,以及如何进行身份验证

提问于
浏览
0

本地存储和会话存储中的令牌存储如何生成令牌以及使用令牌存储进行角度应用程序角度身份验证的管理员用户身份验证的安全性与浏览器或应用程序中的会话存储安全相同

1 回答

  • 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.
    

相关问题