isTokenExpired property

bool get isTokenExpired

Returns true if the token has expired on this device.

A user without expiresAt (e.g. one stored by wp_json_api 4.x) is treated as expired, because WP JSON API 5.0 tokens always expire.

Implementation

bool get isTokenExpired {
  if (expiresAt == null) return true;
  return DateTime.now().millisecondsSinceEpoch ~/ 1000 >= expiresAt!;
}