当JWT过期时,是否会自动删除存储在本地存储中的JWT? [英] When JWT expires, will the JWT stored in local storage be removed automatically?

查看:373
本文介绍了当JWT过期时,是否会自动删除存储在本地存储中的JWT?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将JWT存储在用户浏览器的本地存储中. 我已使用nodejs/express将JWT的到期日期设置为7天.

I have JWT already stored in the user's browser's local storage. I have set the JWT's expiration date to be on in 7 days using nodejs/express.

浏览器会检测到到期日期并自动将其从本地存储中删除吗?还是我的服务器必须检查JWT并将过期的JWT从用户浏览器的本地存储中删除?

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是否已过期并删除它.将过期的JWT保留在本地存储中没有任何危害,因为一旦过期,就没有人可以使用它.

Local storage does not have an auto-expiring feature so the browser will not remove the JWT from local storage. It will be up to you or a library to inspect if a JWT has expired and remove it. There is no harm in leaving an expired JWT in local storage as once it has expired no one can use it.

这篇关于当JWT过期时,是否会自动删除存储在本地存储中的JWT?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆