Closed gautammd closed 1 year ago
Hey, below is the function am using for issuing a token and later when I try to verify the token immediately, I get false.
false
I tried HS256, HS512 algorithms, same issue. surprisingly, verify works if I don't pass nbf and exp whilst issuing.
verify
nbf
exp
import jwt from "@tsndr/cloudflare-worker-jwt" const issueToken = async (payload: any, secret: string) => { return await jwt.sign({ ...payload, nbf: Math.floor(Date.now() / 1000) + (60 * 60), // Not before: Now + 1h exp: Math.floor(Date.now() / 1000) + (2 * (60 * 60)) // Expires: Now + 2h }, secret) }
Thank you again for this library :)
Because the token will be valid in an hour from now (see: https://github.com/tsndr/cloudflare-worker-jwt/issues/30)
Hey, below is the function am using for issuing a token and later when I try to verify the token immediately, I get
false
.I tried HS256, HS512 algorithms, same issue. surprisingly,
verify
works if I don't passnbf
andexp
whilst issuing.Thank you again for this library :)