When verifying JWTs, you can account for clock drift using .withClockSkew(seconds) on the decoder.
For testing purposes, you can use JWT.getTimeMachineDecoder(ZonedDateTime) to verify a JWT against a specific point in time (e.g., to test expired tokens). Note: The time machine decoder is for testing only and should not be used in production.
// Verify with 60 seconds of clock skew allowed
Verifier verifier = ECVerifier.newVerifier(Paths.get("public_key.pem"));
JWT jwt = JWT.getDecoder().withClockSkew(60).decode(encodedJWT, verifier);
// Time machine decoder for testing (do not use in production)
ZonedDateTime thePast = ZonedDateTime.of(2019, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC);
JWT jwt = JWT.getTimeMachineDecoder(thePast).decode(encodedJWT, verifier);