php - pragmarx/google2fa-laravel verifyKey always returns false

one text

PHP v7.4, Laravel v7.28.3 I use pragmarx/google2fa-laravel

QR code generating:

$google2fa = app('pragmarx.google2fa');
$google2fa->setAlgorithm(Constants::SHA512);
$secret = $google2fa->generateSecretKey(64);
$user->google2fa_secret = $secret;
$user->save();

$QR_Image = $google2fa->getQRCodeInline(
    config('app.name'),
    $user->email,
    $user->google2fa_secret
);

Then I render the QR on frontend. Qr code looks perfectly, I scan it by Google 2fa application and code generator successfully adds to app.

When i try to verify codes from app it always returns false. Verification code:

 $code = 'I paste here the code from the application manually';
 $google2fa = app('pragmarx.google2fa');
 var_dump($google2fa->verifyKey($user->google2fa_secret, $code, 10));

BUT when I add code generator to mobile app manually using $user->google2fa_secret (i can check it in database) it works perfectly, all codes from this generator pass validation. Seems like a problem is in generated QR image...

Source