1. First create a secret and associate it with a user
  2. Next create a QR code and let the user scan it:

    ...or display the secret to the user for manual entry: HT6U WGIZ FAVT C6UJ
  3. Next, have the user verify the code; at this time the code displayed by a 2FA-app would be: 332152 (but that changes periodically)
  4. When the code checks out, 2FA can be / is enabled; store (encrypted?) secret with user and have the user verify a code each time a new session is started.
  5. When aforementioned code (332152) was entered, the result would be: OK

Note: Make sure your server-time is NTP-synced! Depending on the $discrepancy allowed your time cannot drift too much from the users' time!


Fatal error: Uncaught Error: Call to undefined function socket_create() in C:\xampp\htdocs\vendor\robthree\twofactorauth\lib\Providers\Time\NTPTimeProvider.php:34 Stack trace: #0 C:\xampp\htdocs\vendor\robthree\twofactorauth\lib\TwoFactorAuth.php(147): RobThree\Auth\Providers\Time\NTPTimeProvider->getTime() #1 C:\xampp\htdocs\vendor\robthree\twofactorauth\demo\demo.php(44): RobThree\Auth\TwoFactorAuth->ensureCorrectTime() #2 {main} thrown in C:\xampp\htdocs\vendor\robthree\twofactorauth\lib\Providers\Time\NTPTimeProvider.php on line 34