Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Charts API discontinued – QR Code generation fails #4579

Open
amarildosertorio opened this issue Jan 31, 2025 · 7 comments
Open

Google Charts API discontinued – QR Code generation fails #4579

amarildosertorio opened this issue Jan 31, 2025 · 7 comments
Labels

Comments

@amarildosertorio
Copy link

Hello,

I'm experiencing an issue with QR code generation in TeamPass due to the deprecation of chart.googleapis.com. When attempting to generate a QR code for Google Authenticator, the following error occurs:

PHP Fatal error: Uncaught TypeError: RobThree\Auth\Providers\Qr\QRServerProvider::getQRCodeImage(): Return value must be of type string, false returned in /var/www/html/teampass/vendor/robthree/twofactorauth/lib/Providers/Qr/QRServerProvider.php:36 Stack trace: #0 /var/www/html/teampass/vendor/robthree/twofactorauth/lib/TwoFactorAuth.php(120): RobThree\Auth\Providers\Qr\QRServerProvider->getQRCodeImage() #1 /var/www/html/teampass/sources/identify.php(1611): RobThree\Auth\TwoFactorAuth->getQRCodeImageAsDataUri() #2 /var/www/html/teampass/sources/identify.php(2489): googleMFACheck() #3 /var/www/html/teampass/sources/identify.php(344): identifyDoMFAChecks() #4 /var/www/html/teampass/sources/identify.php(85): identifyUser() #5 {main} thrown in /var/www/html/teampass/vendor/robthree/twofactorauth/lib/Providers/Qr/QRServerProvider.php on line 36

Since chart.googleapis.com has been discontinued, this API call no longer works and returns a 404 Not Found error.

Possible Fix

A possible solution is to replace the URL with an alternative QR code generation API, such as QRServer:

return 'https://api.qrserver.com/v1/create-qr-code/?' . http_build_query($queryParameters);

Would it be possible to update the codebase with a new provider, or make the QR code provider configurable?

Thanks in advance!

@amarildosertorio
Copy link
Author

amarildosertorio commented Jan 31, 2025

Validation passed without any errors.

Image
Image

@nilsteampassnet
Copy link
Owner

hi @amarildosertorio
Thank you for this feedback.
I will work on it.

@nilsteampassnet
Copy link
Owner

@amarildosertorio
What version do you use?
I have just performed some tests and it works correctly

Image

@amarildosertorio
Copy link
Author

amarildosertorio commented Feb 9, 2025

Hello! I am using TeamPass version 3.1.3.10. The error occurs during the reset process when the application calls the API to generate the QR Code image.

Interesting! How was the QR Code generated if the Google API is returning "Not Found"?

Image

Image

@nilsteampassnet
Copy link
Owner

It doesn't use google chart api to generate the QR code but https://goqr.me/api/doc/create-qr-code/

@amarildosertorio
Copy link
Author

Hello! My TeamPass is behind a firewall, and until now, there was only an outbound rule for the domains mentioned in the documentation, as well as a recent rule for the domain exposed in the test. Thank you for your response, and I would like to suggest updating the documentation and considering the use of an internal library to avoid relying on external agents.

Image

@nilsteampassnet
Copy link
Owner

Hello
Yes I have this in mind but the solution requires minimum 8.2 php version to work.
Currently teampass requires 8.1 so there is a gap to reach that could have impact on users instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants