When the sketch starts I set the time on the board with
Code: Select all
configTime(0, 0, "pool.ntp.org", "time.nist.gov");
here is my JWT refresh method
Code: Select all
String getJwt() {
if (iss == 0 || time(nullptr) - iss > 82800) {
iss = time(nullptr);
Serial.print("Time");
Serial.println(iss);
Serial.println("Refreshing JWT");
jwt = device->createJWT(iss);
Serial.println(jwt);
} else {
Serial.println("Reusing still-valid JWT");
}
return jwt;
}