expiresInSeconds method

int? expiresInSeconds([
  1. DateTime? now
])

Returns the number of whole seconds until expiresAt, mirroring the OAuth 2.0 expires_in field used in token responses.

Returns null when expiresAt is not set. Returns 0 (never negative) when the token is already expired so callers can re-serialize a token without producing an invalid expires_in.

Implementation

int? expiresInSeconds([DateTime? now]) => remainingLifetime(now)?.inSeconds;