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's QR API is dead #34

Open
echometerain opened this issue Apr 7, 2024 · 11 comments
Open

Google's QR API is dead #34

echometerain opened this issue Apr 7, 2024 · 11 comments

Comments

@echometerain
Copy link

Use https://api.qrserver.com/v1/create-qr-code/?size=200x200&data= + generateOtpAuthUrl() instead of qrImageUrl()

@javaDev1214
Copy link

For generating QR code is not such a problem.

How to get: String generatedCode = TimeBasedOneTimePasswordUtil.generateCurrentNumberString(key) from URL above?

Thanks

@echometerain
Copy link
Author

echometerain commented Apr 10, 2024

Assuming url is in the form of https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=otpauth://totp/LoginSystem%3Fsecret%3DQYX6DXSBCNHGE5RV%26digits%3D6 then do something like generateCurrentNumberString(url.substring(100, 117))

note: the first D after secret is actually a part of %3D which is the url encoding for =

@javaDev1214
Copy link

Assuming url is in the form of https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=otpauth://totp/LoginSystem%3Fsecret%3DQYX6DXSBCNHGE5RV%26digits%3D6 then do something like generateCurrentNumberString(url.substring(100, 117))

note: the first D after secret is actually a part of %3D which is the url encoding for =

Thank you! :)

@dpastov
Copy link

dpastov commented May 3, 2024

@echometerain can't we also generate image without using external service?

@echometerain
Copy link
Author

yeah you definitely could

@dpastov
Copy link

dpastov commented May 5, 2024

@echometerain Can it be done with any QR java library? like https://github.com/nayuki/QR-Code-generator or it requires something more?

@echometerain
Copy link
Author

probably, never tried it though

@dpastov
Copy link

dpastov commented May 8, 2024

I have used: https://github.com/nayuki/QR-Code-generator to generate QR code (based on value from generateOtpAuthUrl).

You will however need to update the method little bit and replace %3F and %26 on ? and & respectively.

@CupidStar
Copy link

For example, I no longer generate the two-dimensional code locally, I want to pass this string to the front end, and the front end will generate the two-dimensional code. In addition, I want to ask, does the authenticator App support

@CupidStar
Copy link

I don't quite understand where to use as the data source to generate the two-dimensional code, can you further help realize it

@echometerain
Copy link
Author

I don't quite understand where to use as the data source to generate the two-dimensional code, can you further help realize it

if you're generating your own QR code (or using your "frontend" to do it), you should make the QR code encode the output of generateOtpAuthUrl()

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

No branches or pull requests

4 participants