isOAuthTokenExpired function

bool isOAuthTokenExpired(
  1. int? expiresAt
)

Check if an OAuth token is expired (with 5 minute buffer).

Implementation

bool isOAuthTokenExpired(int? expiresAt) {
  if (expiresAt == null) return false;
  const bufferTime = 5 * 60 * 1000; // 5 minutes in ms
  final now = DateTime.now().millisecondsSinceEpoch;
  return (now + bufferTime) >= expiresAt;
}