So i get a empty respoounse from Google2FA every time i try to validate the key:
It does not matter how much i try i get the same anwser $valid is empty. And i do not get any errors what so ever!
require("requirements/page.php");
use PragmaRX\Google2FA\Google2FA;
$google2fa = new Google2FA();
if (isset($_GET['code'])) {
$secret = $_GET['code'];
$user_secret = $session->getUserInfo("2fa_secret");
if ($user_secret == null) {
header('location: /auth/login');
die();
}
try {
$valid = $google2fa->verifyKey($user_secret, $secret);
if ($valid) {
echo "Input 2FA Code: $secret<br>";
echo "User's 2FA Secret: $user_secret<br>";
die("Success: $valid");
} else {
echo "Input 2FA Code: $secret<br>";
echo "User's 2FA Secret: $user_secret<br>";
die("Failed: $valid");
}
} catch (Exception $ex) {
die($ex);
}
}