我有一组网页使用了一些需要 JWT 作为身份验证 header 的 API。这个JWT是登录成功后生成的。成功登录后将 jwt 从一个页面发送到另一个页面的最合适方法是什么?
最佳答案
您可以使用其中任何一个来存储 JWT:
- HTML5 网络存储(localStorage 或 sessionStorage)
- cookies
作为explained in this article将 JWT 存储在网络应用程序的 cookie 中,因为它们提供了额外的安全性。
What would be the most appropriate way of sending jwt from one page to another after a successful login?
从另一个页面的 cookie/网络存储中检索 token 。
关于javascript - 登录成功后如何将JSON Web Tokens传递给不同的网页?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61995199/