@theredhead — Frontend Library - v1.0.0
    Preparing search index...
    • Calculate the number of seconds until a JWT expires.

      Parameters

      • payload: JwtPayload

        The decoded JWT payload.

      • nowSeconds: number = ...

        Current time in seconds since epoch.

      Returns number

      Seconds remaining, or Infinity if there is no exp claim. A negative value means the token is already expired.

      const remaining = secondsUntilExpiry(jwt.payload);
      if (remaining < 300) {
      // less than 5 minutes — trigger silent refresh
      }