0

I need to compare dates. One date is gotten from JWT and the other is gotten from Javascript getTime(). But the 2 dates that should bre relatively close have a differents of X1000.

Javascript getTime() -> 1553001077175 Java JWT expiration -> 1553087477

I get the expiration from JWT by doing the base64 conversion.

JWT expiration is calculated as follows:

long now = (new Date()).getTime();
        Date validity;
        validity = new Date(now + this.tokenValidityInMilliseconds);

And then butten into JWT like so:

Jwts.builder()....setExpration(validity).compact()

Why is the difference so large?

Marko Taht
  • 1,448
  • 1
  • 20
  • 40

0 Answers0