Question: how to check whether my token is expired or not?

```
var token = jwt.sign(user,app.get('superSecret'),{
    expiresIn : 2
});

```

Answer: 
```
var isExpiredToken = false;

var dateNow = new Date();

if(decodedToken.exp < dateNow.getTime()/1000)

{
       isExpiredToken = true;
}

```
```
var isExpiredToken = false;
var seconds = 1000;
var d = new Date();
var t= d.getTime();

if (decoded.exp < Math.round(t / seconds)) {
  // code...
  isExpiredToken = true;
}

```

Source:
<https://www.w3schools.com/jsref/jsref_gettime.asp>