PHP code example of sebastiandevs / simplethenticator
1. Go to this page and download the library: Download sebastiandevs/simplethenticator 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/ */
sebastiandevs / simplethenticator example snippets
use SebastianDevs\SimpleAuthenticator;
$auth = new SimpleAuthenticator(6, 'SHA1');
try
{
$secret = $auth->createSecret();
}
catch (Exception $e)
{
echo $e->getMessage();
exit();
}
echo 'Secret is: ' . $secret . '\n';
$qrCodeUrl = $auth->getQRCodeGoogleUrl($secret, '[email protected]', 'Business');
echo 'QR-Code: ' . $qrCodeUrl . '\n';
$oneCode = $auth->getCode($secret);
echo 'Checking Code ' . $oneCode . ' and Secret ' . $secret . ':\n';
echo $auth->verifyCode($secret, $oneCode, 2)? 'OK': 'NOT OK';