@@ -3,6 +3,48 @@ Troubleshooting
33
44How to debug and solve common issue related to the bundle.
55
6+ - [ TOTP / Google Authenticator code is not accepted] ( #totp--google-authenticator-code-is-not-accepted )
7+ - [ Logout redirects back to the two-factor authentication form] ( #logout-redirects-back-to-the-two-factor-authentication-form )
8+ - [ Not logged in after completing two-factor authentication] ( #not-logged-in-after-completing-two-factor-authentication )
9+ - [ Two-factor authentication form is not shown after login] ( #two-factor-authentication-form-is-not-shown-after-login )
10+ - [ Trusted device cookie is not set] ( #trusted-device-cookie-is-not-set )
11+
12+
13+ ## TOTP / Google Authenticator code is not accepted
14+
15+ The principle of TOTP/Google Authenticator is that both systems - the server and your device - generate the same
16+ authentication code from a shared secret and the current time. If one of those two components isn't in sync, they'll
17+ generate a different code. Therefore:
18+
19+ 1 ) Most common cause: Make sure the UTC time on your server and device are in sync
20+ 2 ) Make sure the secret used in your device matches the secret configured for the account
21+
22+ The time window for a code is 30 seconds (in Google Authenticator, for TOTP it depends on your configuration). The
23+ bigger the time difference between server/device, the smaller the time window in which both generate the same code. If
24+ the time difference becomes too large, it can become impossible to provide the right code.
25+
26+ To counteract the issue of time differences, you could increase the ` window ` setting, so accept more codes around the
27+ current valid code will be accepted:
28+
29+ ``` yaml
30+ # config/packages/scheb_two_factor.yaml
31+ scheb_two_factor :
32+
33+ # For TOTP
34+ totp :
35+ window : 1 # How many codes before/after the current one would be accepted as valid
36+
37+ # For Google Authenticator
38+ google :
39+ window : 1 # How many codes before/after the current one would be accepted as valid
40+ ` ` `
41+
42+ You might want to configure a time synchronization service, such as ` ntpdate` on your server to make sure your server
43+ time is always in sync with UTC.
44+
45+ The Google Authenticator app has an option to sync your device time. Open the app and select
46+ ` Settings > Time correction for codes > Sync now` from the menu. Other apps might have a similar option.
47+
648
749# # Logout redirects back to the two-factor authentication form
850
@@ -176,7 +218,8 @@ if (!($token instanceof TwoFactorTokenInterface)) {
176218 - **Solution:** our user doesn't have an active two-factor authentication method. Either the `is*Enabled` method
177219 returns `false` or an essential piece of data (e.g. Google Authenticator secret) is missing.
178220
179- # Trusted device cookie is not set
221+
222+ # # Trusted device cookie is not set
180223
181224# ## Problem
182225
0 commit comments