PHP code example of paragonie / multi-factor
1. Go to this page and download the library: Download paragonie/multi-factor library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
paragonie / multi-factor example snippets
use ParagonIE\MultiFactor\OneTime;
use ParagonIE\MultiFactor\OTP\TOTP;
$seed = random_bytes(20);
// You can use TOTP or HOTP
$otp = new OneTime($seed, new TOTP());
if (\password_verify($_POST['password'], $storedHash)) {
if ($otp->validateCode($_POST['2facode'], time())) {
// Login successful
}
}