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

3.1k Views Asked by At

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.

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?

1

There are 1 best solutions below

1
Shane Rowatt On BEST ANSWER

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.