Answers for "check stored jwt expiration"

0

check stored jwt expiration

const checkTokenExpirationMiddleware = store => next => action => {
  const token =
    JSON.parse(localStorage.getItem("user")) &&
    JSON.parse(localStorage.getItem("user"))["token"];
  if (jwtDecode(token).exp < Date.now() / 1000) {
    next(action);
    localStorage.clear();
  }
  next(action);
};
Posted by: Guest on March-23-2022

Code answers related to "check stored jwt expiration"

Code answers related to "Javascript"

Browse Popular Code Answers by Language