Skip to content

Commit 5a8b8ab

Browse files
committed
fix(auth): correct oneTimeToken expiresIn unit (minutes, not seconds)
Better-auth's oneTimeToken expiresIn is in minutes (multiplied by 60_000ms internally). Sim's existing 24*60*60 evaluated to ~60 days of token lifetime instead of the intended 24 hours. Tokens are one-time-use and typically consumed within seconds of generation (Socket.IO handshake), so this tightens an unused security window without affecting UX.
1 parent 6d360b4 commit 5a8b8ab

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

apps/sim/lib/auth/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@ export const auth = betterAuth({
880880
} as Record<string, unknown>,
881881
}),
882882
oneTimeToken({
883-
expiresIn: 24 * 60 * 60, // 24 hours - Socket.IO handles connection persistence with heartbeats
883+
expiresIn: 24 * 60, // 24 hours in minutes (better-auth's expiresIn unit)
884884
}),
885885
customSession(async ({ user, session }) => ({
886886
user,

packages/auth/src/verify.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function createVerifyAuth(options: VerifyAuthOptions) {
2727
}),
2828
plugins: [
2929
oneTimeToken({
30-
expiresIn: 24 * 60 * 60,
30+
expiresIn: 24 * 60,
3131
}),
3232
],
3333
})

0 commit comments

Comments
 (0)