antonioribeiro / google2fa

A One Time Password Authentication package, compatible with Google Authenticator.
MIT License
1.83k stars 199 forks source link

QRCode URL shows 404 #199

Closed mm-louis closed 4 months ago

mm-louis commented 5 months ago

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.

akyagmur commented 4 months ago

Unfortunately, this service has been deprecated.

dragonofmercy commented 4 months ago

You can switch to this library and use his local QR Code generator

https://github.com/RobThree/TwoFactorAuth

ankit-singh-vu commented 4 months ago

I am facing the same issue from almost 2 weeks. What is good alternative ? Bacon/QRCode?

dragonofmercy commented 4 months ago

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

mfn commented 4 months ago

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.

ankit-singh-vu commented 4 months ago

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
?>
antonioribeiro commented 4 months ago

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.

mm-louis commented 4 months ago

Thanks everyone! I opted for image-charts.com instead of the Google one.