Skip to content

Commit 3f56398

Browse files
committed
chore: session creation should never be missing if it is, just throw
1 parent a2483ac commit 3f56398

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

controlplane/src/core/auth-utils.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,8 @@ export default class AuthUtils {
317317
throw new AuthenticationError(EnumStatusCode.ERROR_NOT_AUTHENTICATED, 'Refresh token expired');
318318
}
319319

320-
// The session expiration is relative to the creation time.
321-
// If the session doesn't have a creation timestamp, fall back to "now".
322-
const baseMs = userSession.createdAt?.getTime() ?? Date.now();
320+
// The session expiration is relative to the creation time
321+
const baseMs = userSession.createdAt.getTime();
323322
const expiresAtMs = baseMs + DEFAULT_SESSION_MAX_AGE_SEC * 1000;
324323
const sessionExpiresDate = new Date(expiresAtMs);
325324
const remainingSeconds = Math.max(0, Math.floor((expiresAtMs - Date.now()) / 1000));

0 commit comments

Comments
 (0)