#Wrong nbf time when decoding JWT token in nestjs

4 messages · Page 1 of 1 (latest)

lone pendant
#

in my app.module I Register JWT as :

    JwtModule.register({
      secret: `${process.env.JWT_SECRET}`,
      signOptions: {
      expiresIn: "24h" ,
      notBefore:  Math.floor(new Date().getTime() / 1000) ,
      
    },

but when i decode the token I get these timestamps:

 iat: 1699944419,
 nbf: 3399888838,
 exp: 1700030819

nbf times shows a wrong datetime ( Sunday, September 26, 2077 5:03:58 PM )

slate thicket
#

What are you wanting the notBefore to be?

lone pendant
slate thicket
#

Then use 0. The notBefore adds the value passed to it to the current time. And numeric values are treated as milliseconds