[GH-ISSUE #107] Google Infographics QR Code API is deprecated #518

Closed
opened 2026-03-14 12:03:26 +03:00 by kerem · 22 comments
Owner

Originally created by @bdteo on GitHub (Jul 23, 2018).
Original GitHub issue: https://github.com/antonioribeiro/google2fa/issues/107

See: https://developers.google.com/chart/infographics/docs/qr_codes

Originally created by @bdteo on GitHub (Jul 23, 2018). Original GitHub issue: https://github.com/antonioribeiro/google2fa/issues/107 See: https://developers.google.com/chart/infographics/docs/qr_codes
kerem 2026-03-14 12:03:26 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@antonioribeiro commented on GitHub (Oct 7, 2018):

Will check it, thank you!

<!-- gh-comment-id:427615970 --> @antonioribeiro commented on GitHub (Oct 7, 2018): Will check it, thank you!
Author
Owner

@Chevil5 commented on GitHub (Mar 19, 2019):

Hi, is there any updates about that? 5 days ago Google turned off QR code generator api. And now it does not work at all.

<!-- gh-comment-id:474454738 --> @Chevil5 commented on GitHub (Mar 19, 2019): Hi, is there any updates about that? 5 days ago Google turned off QR code generator api. And now it does not work at all.
Author
Owner

@barryvdh commented on GitHub (Mar 19, 2019):

I can confirm that currently:

  • Google Chart API is offline, so URL doesn't work
  • Bacon 2.x is released a year ago and doesn't work with this package.
<!-- gh-comment-id:474497541 --> @barryvdh commented on GitHub (Mar 19, 2019): I can confirm that currently: - Google Chart API is offline, so URL doesn't work - Bacon 2.x is released a year ago and doesn't work with this package.
Author
Owner

@antonioribeiro commented on GitHub (Mar 19, 2019):

Why Bacon doesn't work with it? When I removed it from this package to create the google2fa-bridge I tested it with both 1.x and 2.x...

<!-- gh-comment-id:474513066 --> @antonioribeiro commented on GitHub (Mar 19, 2019): Why Bacon doesn't work with it? When I removed it from this package to create the google2fa-bridge I tested it with both 1.x and 2.x...
Author
Owner

@barryvdh commented on GitHub (Mar 19, 2019):

Oh sorry, I'm still on the 2.x branch.
I just saw your qr code package, but you don't mention it in the readme, right?
https://github.com/antonioribeiro/google2fa#qr-code-packages

An alternative would be to use http://goqr.me/api/ but I think it would probably best to not provide external API for this sensitive stuff.

<!-- gh-comment-id:474518659 --> @barryvdh commented on GitHub (Mar 19, 2019): Oh sorry, I'm still on the 2.x branch. I just saw your qr code package, but you don't mention it in the readme, right? https://github.com/antonioribeiro/google2fa#qr-code-packages An alternative would be to use http://goqr.me/api/ but I think it would probably best to not provide external API for this sensitive stuff.
Author
Owner

@antonioribeiro commented on GitHub (Mar 19, 2019):

With Bacon 2.0:

Installing:

composer require bacon/bacon-qr-code

Using:

<?php

use PragmaRX\Google2FA\Google2FA;
use BaconQrCode\Renderer\ImageRenderer;
use BaconQrCode\Renderer\Image\ImagickImageBackEnd;
use BaconQrCode\Renderer\RendererStyle\RendererStyle;
use BaconQrCode\Writer;

$google2fa = app(Google2FA::class);

$g2faUrl = $google2fa->getQRCodeUrl(
    'pragmarx',
    'google2fa@pragmarx.com',
    $google2fa->generateSecretKey()
);

$writer = new Writer(
    new ImageRenderer(
        new RendererStyle(400),
        new ImagickImageBackEnd()
    )
);

$writer->writeFile($g2faUrl, 'qrcode.png');

// or

dd($writer->writeString($g2faUrl));
<!-- gh-comment-id:474522474 --> @antonioribeiro commented on GitHub (Mar 19, 2019): With Bacon 2.0: Installing: ``` composer require bacon/bacon-qr-code ``` Using: ``` <?php use PragmaRX\Google2FA\Google2FA; use BaconQrCode\Renderer\ImageRenderer; use BaconQrCode\Renderer\Image\ImagickImageBackEnd; use BaconQrCode\Renderer\RendererStyle\RendererStyle; use BaconQrCode\Writer; $google2fa = app(Google2FA::class); $g2faUrl = $google2fa->getQRCodeUrl( 'pragmarx', 'google2fa@pragmarx.com', $google2fa->generateSecretKey() ); $writer = new Writer( new ImageRenderer( new RendererStyle(400), new ImagickImageBackEnd() ) ); $writer->writeFile($g2faUrl, 'qrcode.png'); // or dd($writer->writeString($g2faUrl)); ```
Author
Owner

@barryvdh commented on GitHub (Mar 19, 2019):

Thanks, I've updated generate the QR with https://github.com/endroid/qr-code

function qrCodeUrl($value, $size = 200)
{
    $qrCode = new \Endroid\QrCode\QrCode($value);

    $qrCode->setSize($size);

    return $qrCode->writeDataUri();
}

But should we remove the Google API?

<!-- gh-comment-id:474524759 --> @barryvdh commented on GitHub (Mar 19, 2019): Thanks, I've updated generate the QR with https://github.com/endroid/qr-code ```php function qrCodeUrl($value, $size = 200) { $qrCode = new \Endroid\QrCode\QrCode($value); $qrCode->setSize($size); return $qrCode->writeDataUri(); } ``` But should we remove the Google API?
Author
Owner

@antonioribeiro commented on GitHub (Mar 19, 2019):

Oh sorry, I'm still on the 2.x branch.
I just saw your qr code package, but you don't mention it in the readme, right?
https://github.com/antonioribeiro/google2fa#qr-code-packages

An alternative would be to use http://goqr.me/api/ but I think it would probably best to not provide external API for this sensitive stuff.

Yeah, sorry, I wasn't really sure about "tying" one more package to this stack. But I will update the README and add some examples using it (mine), Bacon and Endroid.

<!-- gh-comment-id:474525741 --> @antonioribeiro commented on GitHub (Mar 19, 2019): > Oh sorry, I'm still on the 2.x branch. > I just saw your qr code package, but you don't mention it in the readme, right? > https://github.com/antonioribeiro/google2fa#qr-code-packages > > An alternative would be to use http://goqr.me/api/ but I think it would probably best to not provide external API for this sensitive stuff. Yeah, sorry, I wasn't really sure about "tying" one more package to this stack. But I will update the README and add some examples using it (mine), Bacon and Endroid.
Author
Owner

@antonioribeiro commented on GitHub (Mar 19, 2019):

But should we remove the Google API?

Yes, we must.

And thanks a lot for the Endroid fix!

<!-- gh-comment-id:474526515 --> @antonioribeiro commented on GitHub (Mar 19, 2019): > But should we remove the Google API? Yes, we must. And thanks a lot for the Endroid fix!
Author
Owner

@antonioribeiro commented on GitHub (Mar 19, 2019):

That Google API was deprecated in favor of https://developers.google.com/chart/, but I'm not sure there is a QRCode API inside it, will have to look better.

<!-- gh-comment-id:474527398 --> @antonioribeiro commented on GitHub (Mar 19, 2019): That Google API was deprecated in favor of https://developers.google.com/chart/, but I'm not sure there is a QRCode API inside it, will have to look better.
Author
Owner

@antonioribeiro commented on GitHub (Mar 19, 2019):

@barryvdh, thanks for the PR.

Will try to add some more examples later.

<!-- gh-comment-id:474531973 --> @antonioribeiro commented on GitHub (Mar 19, 2019): @barryvdh, thanks for the PR. Will try to add some more examples later.
Author
Owner

@barryvdh commented on GitHub (Mar 19, 2019):

I don't think it supports QR code. So we can either:

  • Deprecate it and leave it in as not working, remove in next version (but will be broken and many won't notice)
  • Throw an Exception to make it clear what is happening (breaking, but it's already broken)
  • Replace with different API (but insecure)
  • Silently replace with an data URL (eg. with bacon), not the same but doesn't break (but could lead to dependancy conflicts)
<!-- gh-comment-id:474538197 --> @barryvdh commented on GitHub (Mar 19, 2019): I don't think it supports QR code. So we can either: - Deprecate it and leave it in as not working, remove in next version (but will be broken and many won't notice) - Throw an Exception to make it clear what is happening (breaking, but it's already broken) - Replace with different API (but insecure) - Silently replace with an data URL (eg. with bacon), not the same but doesn't break (but could lead to dependancy conflicts)
Author
Owner

@Chevil5 commented on GitHub (Mar 19, 2019):

-Silently replace with an data URL (eg. with bacon)
this option looks the most effective. The tool is very useful and it would be cruel just leave it unworking. Really people do not care how QR code generates, but only it should be secure, so to make in in-place by using Bacon would be perfect in my opinion.

<!-- gh-comment-id:474545634 --> @Chevil5 commented on GitHub (Mar 19, 2019): -Silently replace with an data URL (eg. with bacon) this option looks the most effective. The tool is very useful and it would be cruel just leave it unworking. Really people do not care how QR code generates, but only it should be secure, so to make in in-place by using Bacon would be perfect in my opinion.
Author
Owner

@antonioribeiro commented on GitHub (Mar 19, 2019):

I was working on removing it for 5.0.0, already pushed some code to it, but looks like we will have to think this better.

I'm not found of adding Bacon or any other dependency back to this package, but if we do, to get a "fixed" version people would have to composer update, so here's a question:

Is there a way to make Composer warn people and tell them to upgrade to 5.0.0 and check the docs for options?

<!-- gh-comment-id:474549734 --> @antonioribeiro commented on GitHub (Mar 19, 2019): I was working on removing it for 5.0.0, already pushed some code to it, but looks like we will have to think this better. I'm not found of adding Bacon or any other dependency back to this package, but if we do, to get a "fixed" version people would have to `composer update`, so here's a question: Is there a way to make Composer warn people and tell them to upgrade to 5.0.0 and check the docs for options?
Author
Owner

@Chevil5 commented on GitHub (Mar 19, 2019):

As far as I can see - no. And googling did not give any results.

But as a user, I can say it would be clear for me what is going on if on the first line of the documentation we will write: "Google API for QR generator is turned off. All version of that package less than 5.0.0 is deprecated and non-working. Please, make composer update and check documentation regarding new generation QR logic".
In a few days, people will see that QR code is broken and will start googling or checking the documentation. And way they will find this information.

<!-- gh-comment-id:474555595 --> @Chevil5 commented on GitHub (Mar 19, 2019): As far as I can see - no. And googling did not give any results. But as a user, I can say it would be clear for me what is going on if on the first line of the documentation we will write: "Google API for QR generator is turned off. All version of that package less than 5.0.0 is deprecated and non-working. Please, make `composer update` and check documentation regarding new generation QR logic". In a few days, people will see that QR code is broken and will start googling or checking the documentation. And way they will find this information.
Author
Owner

@barryvdh commented on GitHub (Mar 19, 2019):

An alternative would be to patch to previous version(s) to a hardcoded data url, with a message so it's more of a Soft fail.

<!-- gh-comment-id:474564199 --> @barryvdh commented on GitHub (Mar 19, 2019): An alternative would be to patch to previous version(s) to a hardcoded data url, with a message so it's more of a Soft fail.
Author
Owner

@antonioribeiro commented on GitHub (Mar 19, 2019):

As far as I can see - no. And googling did not give any results.

But as a user, I can say it would be clear for me what is going on if on the first line of the documentation we will write: "Google API for QR generator is turned off. All version of that package less than 5.0.0 is deprecated and non-working. Please, make composer update and check documentation regarding new generation QR logic".
In a few days, people will see that QR code is broken and will start googling or checking the documentation. And way they will find this information.

Done:

image

<!-- gh-comment-id:474618332 --> @antonioribeiro commented on GitHub (Mar 19, 2019): > As far as I can see - no. And googling did not give any results. > > But as a user, I can say it would be clear for me what is going on if on the first line of the documentation we will write: "Google API for QR generator is turned off. All version of that package less than 5.0.0 is deprecated and non-working. Please, make `composer update` and check documentation regarding new generation QR logic". > In a few days, people will see that QR code is broken and will start googling or checking the documentation. And way they will find this information. Done: ![image](https://user-images.githubusercontent.com/3182864/54640123-c9db6480-4a6d-11e9-8424-bafed069c984.png)
Author
Owner

@antonioribeiro commented on GitHub (Mar 19, 2019):

What about this?:

image

As a warning when people composer update?

<!-- gh-comment-id:474619583 --> @antonioribeiro commented on GitHub (Mar 19, 2019): What about this?: ![image](https://user-images.githubusercontent.com/3182864/54647876-f51c7e80-4a82-11e9-8696-4bcd721f9be4.png) As a warning when people `composer update`?
Author
Owner

@antonioribeiro commented on GitHub (Mar 20, 2019):

It's done, but not working. Not sure why

https://github.com/Ocramius/PackageVersions/blob/master/composer.json

works, but this one doesn't:

https://github.com/antonioribeiro/google2fa/blob/v4.0.2/composer.json

<!-- gh-comment-id:474630851 --> @antonioribeiro commented on GitHub (Mar 20, 2019): It's done, but not working. Not sure why https://github.com/Ocramius/PackageVersions/blob/master/composer.json works, but this one doesn't: https://github.com/antonioribeiro/google2fa/blob/v4.0.2/composer.json
Author
Owner

@Chevil5 commented on GitHub (Mar 20, 2019):

Done:

@antonioribeiro thank you! Looks super noticeable and understandable! I also checked fixed documentation it looks very clear. I already fixed my code by your recommendations with Bacon and it works like a charm. So thank you for your work!

Warning in console looks also very good. But I'm not sure how to force it to work. It looks correct as far I can see.

<!-- gh-comment-id:474713958 --> @Chevil5 commented on GitHub (Mar 20, 2019): > Done: @antonioribeiro thank you! Looks super noticeable and understandable! I also checked fixed documentation it looks very clear. I already fixed my code by your recommendations with Bacon and it works like a charm. So thank you for your work! Warning in console looks also very good. But I'm not sure how to force it to work. It looks correct as far I can see.
Author
Owner

@antonioribeiro commented on GitHub (Mar 20, 2019):

Opened an issue in Composer to try to understand and fix it: https://github.com/composer/composer/issues/8049

<!-- gh-comment-id:474806943 --> @antonioribeiro commented on GitHub (Mar 20, 2019): Opened an issue in Composer to try to understand and fix it: https://github.com/composer/composer/issues/8049
Author
Owner

@hopeseekr commented on GitHub (Jul 14, 2019):

There is a way to immediately warn people... But it's not that good.

  1. Edit this package's composer.json and give it either a new name or a new vendor, or both.
  2. Mark this current package on packagist as abandoned.
  3. Add as a Recommendation the new package name.

Then, any time anyone does composer install or composer update, they'll get a big red warning google2fa is abandoned: Use google-2fa instead..

<!-- gh-comment-id:511229387 --> @hopeseekr commented on GitHub (Jul 14, 2019): There is a way to immediately warn people... But it's not that good. 1. Edit this package's composer.json and give it either a new name or a new vendor, or both. 2. Mark this current package on packagist as abandoned. 3. Add as a Recommendation the new package name. Then, any time anyone does `composer install` or `composer update`, they'll get a big red warning `google2fa is abandoned: Use google-2fa instead.`.
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/google2fa#518
No description provided.