[PR #3586] [MERGED] fix(docs): state that TOTP verification uses a rolling delay window #21799

Closed
opened 2026-04-15 20:36:41 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/3586
Author: @Hysterelius
Created: 7/24/2025
Status: Merged
Merged: 8/7/2025
Merged by: @Bekacru

Base: mainHead: main


📝 Commits (1)

  • 16c8482 fix: update TOTP 2FA docs to state that Better-Auth implements a delay window

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 docs/content/docs/plugins/2fa.mdx (+1 -1)

📄 Description

Better Auth uses a delay window for TOTP code verification to ensure that it is resilient to time delays which is now explicitly mentioned in the docs, fixed #3515

The code which verifies the TOTP code implements with 'rolling' delay window,
f6fb2523c6/src/otp.ts (L53-L78)


Summary by cubic

Updated the 2FA documentation to explain that Better Auth accepts TOTP codes from one period before and after the current code, making authentication more reliable for users with minor time differences.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/3586 **Author:** [@Hysterelius](https://github.com/Hysterelius) **Created:** 7/24/2025 **Status:** ✅ Merged **Merged:** 8/7/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (1) - [`16c8482`](https://github.com/better-auth/better-auth/commit/16c8482ad86c2ab0a8d2b03c284e780ec409af12) fix: update TOTP 2FA docs to state that Better-Auth implements a delay window ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/2fa.mdx` (+1 -1) </details> ### 📄 Description Better Auth uses a delay window for TOTP code verification to ensure that it is resilient to time delays which is now explicitly mentioned in the docs, fixed #3515 The code which verifies the TOTP code implements with 'rolling' delay window, https://github.com/better-auth/utils/blob/f6fb2523c639cce98b0b4ccf06ee2c5e31f2cf6b/src/otp.ts#L53-L78 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Updated the 2FA documentation to explain that Better Auth accepts TOTP codes from one period before and after the current code, making authentication more reliable for users with minor time differences. <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-15 20:36:41 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#21799