Closed mm-louis closed 4 months ago
Unfortunately, this service has been deprecated.
You can switch to this library and use his local QR Code generator
I am facing the same issue from almost 2 weeks. What is good alternative ? Bacon/QRCode?
I use like this
use RobThree\Auth\TwoFactorAuth;
use RobThree\Auth\Providers\Qr\BaconQrCodeProvider;
$driver = new BaconQrCodeProvider(0, '#ffffff', '#000000', 'svg');
$tfa = new TwoFactorAuth('Company name', 6, 30, 'sha1', $driver);
$tfa->getQRCodeImageAsDataUri('accountname', 'secret', 200);
for the secret use
$secret = $tfa->createSecret();
Don't forget
composer require robthree/twofactorauth
composer require bacon/bacon-qr-code
https://github.com/Bacon/BaconQrCode , it's supported (I use it with google2fa-laravel) and has a SVG backend -> basically no external dependencies and majority of browsers support it.
instead of getQRCodeGoogleUrl() , i used getQRCodeInline() and it worked fine. It required pragmarx/google2fa, pragmarx/google2fa-qrcode and bacon/bacon-qr-code packages.
<?php
use PragmaRX\Google2FAQRCode\Google2FA as Google2FAQRCodeGoogle2FA;
$google2fa = new Google2FAQRCodeGoogle2FA();
$inlineUrl = $google2fa->getQRCodeInline(
$companyName,
$companyEmail,
$secretKey
);
echo $inlineUrl ; //svg format
?>
Yeah the Google service was scheduled to go down. It's actually better to have it inline anyways, like @ankit-singh-vu is doing. Both chillerlan/php-qrcode and Bacon works fine.
Thanks everyone! I opted for image-charts.com instead of the Google one.
For some reason, URL is not working. Here's the sample. https://chart.googleapis.com/chart?chs=200x200&chld=M|0&cht=qr&chl=otpauth%3A%2F%2Ftotp%2FKirlin%2520and%2520Sons%3Ajarod12%2540yahoo.com%3Fsecret%3DJBYGUTKKJA4XKWDEMRHTOQTZLBKGC4CNZCMKL7OLPPOV3FEQEUSYW4EQ7OSRPLHD%26issuer%3DKirlin%2520and%2520Sons
Also, I tried demo page, the QR code image can not be shown either.