简体   繁体   English

当JWT过期时,是否会自动删除存储在本地存储中的JWT?

[英]When JWT expires, will the JWT stored in local storage be removed automatically?

I have JWT already stored in the user's browser's local storage. 我已经将JWT存储在用户浏览器的本地存储中。 I have set the JWT's expiration date to be on in 7 days using nodejs/express. 我已使用nodejs / express将JWT的到期日期设置为7天。

Will the browser detect the expiration date and automatically remove it from the local storage? 浏览器会检测到到期日期并自动将其从本地存储中删除吗? or will my server have to check the JWT and remove the expired JWT from the user's browser's local storage? 还是我的服务器必须检查JWT并将过期的JWT从用户浏览器的本地存储中删除?

Local storage does not have an auto-expiring feature so the browser will not remove the JWT from local storage. 本地存储没有自动过期功能,因此浏览器不会将JWT从本地存储中删除。 It will be up to you or a library to inspect if a JWT has expired and remove it. 由您或图书馆决定JWT是否过期并删除它。 There is no harm in leaving an expired JWT in local storage as once it has expired no one can use it. 将过期的JWT保留在本地存储中没有任何危害,因为一旦过期,就没有人可以使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM