Army Tejash
Army Tejash

Reputation: 1

how to know if the cookie is expired in frontend localstorage

I am building a MERN stack project where the backend sends a cookie with an expiry time of one hour. However, when I store the token in the frontend's local storage, it remains there even after the expiry time. After an hour, when I try to retrieve or update something, I get an "unauthorized" error.

I checked whether the cookie still exists on the frontend, and it is still there. How can I ensure that the token is removed or invalidated properly after expiry?

Upvotes: -1

Views: 22

Answers (0)

Related Questions