What about old expired rows? Who should clean them?

For example, rows in Verification and Sessions table. Should we set up cron job to clean them or BetterAuth does that?
2 Replies
keytrap-x86
keytrap-x863mo ago
Very easy test that I did : - Login - In session table change the expiresAt date to some date older that now. - Refresh your page you will be logged out, and the row will be erased in sessions table. So : - Better-auth automatically removes expired sessions but ONLY when the original user comes back on your page with it's original session token (won't work if he logs again in a private tab for example as he'll have a second session with another ID) So yes if you wan't a clean table you'de have to make a cron to remove expired sessions
NeuhljebTihomir
NeuhljebTihomirOP3mo ago
Yeah, thank you

Did you find this page helpful?