I'm trying to add duration
for each token. For now each token has duration 3600000ms(1hour), and maybe it will change base on term and conditions.
I create the duration using this:
global.duration = 60*60*1000;
and I also have a column called createdAt, default from sequelize. With format
Monday, August 5, 2019 3:22:57 AM +00:00
for each activity with method POST, there will be a token duration checking first. The logic for checking is if the total = duration + createdAt
is less than currenttime
, the request is permitted, if not the user will be ask for re-login.
I don't know how to start, i'm confused because the duration is in millisecond, and the createdAt is in dateTime. I dont know how to total both of them.