Question: I just implemented jwt-simple,on my backend in nodejs.i want to expire token by given time. 

```
 var jwt = require('jwt-simple');
    Schema.statics.encode = (data) => {
    return JWT.encode(data, CONSTANT.ADMIN_TOKEN_SECRET, 'HS256');
};
Schema.statics.decode = (data) => {
    return JWT.decode(data, CONSTANT.ADMIN_TOKEN_SECRET);
};

```

**how to add expires time in jwt-simple**

Answer: 
You can validate your token with a expirate date in the passport Strategy function, like this: 

```
passport.use(new JwtStrategy(opts, function(jwt_payload, done){
    User.find({id: jwt_payload.id}, function(err, user){
        if (err) {
            return done(err, false, {message: "Incorrect Token!!"});
        }
        if (user) {
            if (user[0].token_expiration_date <= Date.now()){
                return done(null, false, {message: "Expired Token"});
            }else{
                return done(null, user);
            }
        }else{
            return done(null, false, {message: "Incorrect Token"});
        }

    });
}));

```

Hope that this can help you.
You can use the exp field in the payload before calling the create function and for example you can use moment to get the time and add whatever you want. If you want to check if the token is expired or other type of error you can use jwt-simple-error-identify instead. 

In his documentation there is an example of that.  

<https://www.npmjs.com/package/jwt-simple-error-identify>