Open echometerain opened 3 months ago
For generating QR code is not such a problem.
How to get: String generatedCode = TimeBasedOneTimePasswordUtil.generateCurrentNumberString(key) from URL above?
Thanks
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 =
Assuming
url
is in the form ofhttps://api.qrserver.com/v1/create-qr-code/?size=200x200&data=otpauth://totp/LoginSystem%3Fsecret%3DQYX6DXSBCNHGE5RV%26digits%3D6
then do something likegenerateCurrentNumberString(url.substring(100, 117))
note: the first
D
aftersecret
is actually a part of%3D
which is the url encoding for=
Thank you! :)
@echometerain can't we also generate image without using external service?
yeah you definitely could
@echometerain Can it be done with any QR java library? like https://github.com/nayuki/QR-Code-generator or it requires something more?
probably, never tried it though
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.
Use
https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=
+generateOtpAuthUrl()
instead ofqrImageUrl()