You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thats it! Two-Factor Authentication is now enabled:
64
+
> 💡 **Note**: Time-Step Size
65
+
>
66
+
> By default, `timeStepWindow` is set to `1`, which means the Two-Factor Authentication Plugin will check the current 30-second time-step, as well as one step before and after, to validate a TOTP code. This aligns with [RFC 6238](https://www.rfc-editor.org/rfc/rfc6238) best practices to accommodate slight clock drift between the server and the user's device.
67
+
>
68
+
> For example, if a code is generated between **12:00:00** and **12:00:30**, it will typically expire at **12:00:30**. However, with a `timeStepWindow` of `1`, the plugin will continue to accept it up to **12:00:59** (the “next” 30-second step), preventing users from being locked out if their device clock is a few seconds off. Once the clock hits **12:01:00**, that previous code will be treated as expired.
69
+
>
70
+
> If you find users frequently encountering code mismatches due to clock drift, you can increase `timeStepWindow` to `2`. **However, be cautious: larger windows can reduce overall security!**
71
+
>
72
+
> ❗ With a `timeStepWindow` set to `0`, the plugin will pass all the expired codes, which is not secure and should only be used for testing purposes.
73
+
74
+
Thats it! Two-Factor Authentication is now enabled:
65
75

66
76
67
77
## Disabling Two-Factor Authentication locally
68
78
69
-
If it is not convenient to enter the code every time you log in during local development, you can disable Two-Factor Authentication
79
+
If it is not convenient to enter the code every time you log in during local development, you can disable Two-Factor Authentication
70
80
for the dev environment using `usersFilterToApply` option.
71
81
72
82
```tstitle='./index.ts'
73
83
74
84
plugins: [
75
-
newTwoFactorsAuthPlugin ({
85
+
newTwoFactorsAuthPlugin ({
76
86
twoFaSecretFieldName: 'secret2fa',
77
87
//diff-add
78
88
usersFilterToApply: (adminUser:AdminUser) => {
@@ -92,10 +102,9 @@ for the dev environment using `usersFilterToApply` option.
92
102
],
93
103
```
94
104
95
-
96
105
## Select which users should use Two-Factor Authentication
97
106
98
-
By default plugin enforces Two-Factor Authentication for all users.
107
+
By default plugin enforces Two-Factor Authentication for all users.
99
108
100
109
If you wish to enforce 2FA only for specific users, you can again use `usersFilterToApply` option:
101
110
@@ -105,7 +114,7 @@ If you wish to enforce 2FA only for specific users, you can again use `usersFilt
0 commit comments