Error: JWTVerificationException :: The Token can't be used before [date/time]

Problem statement

We are verifying the JWT in our Java backend. We are seeing JWTVerificationException :: The Token can’t be used before 2023-05-09T20:31:50Z.

Cause

One of the reasons this might be happening is the operating system and the browser are configured with different time zones. In that case, the browser will be issuing a token for, let’s say 2023-05-09 20:31:50 UTC , but the operating system is “thinking” that the time is something like 09:57:55 UTC. Hence, the error.

Solution

In this case, the we were using time.apple.com which seemed to be behind, and switching to using time.nist.gov helped get it working again.