DEV Community

Discussion on: Selenium Testing - How to sign in to Two-factor authentication?

Collapse
 
jigisha9 profile image
jigisha9 • Edited

jsakamoto

Hi Jsakamoto, We are getting QR Code URL from some 3rd party w/o having any secret key nor they give any option to convert to secret key. Is there any way I can convert QR code to secret key? otherwise I won't able to use your code to get authorized.

Please guide.
Thanks!

Java code:

String otpKeyStr = "6jm7n6xwitpjooh7ihewyyzeux7aqmw2" //secret key

Collapse
 
j_sakamoto profile image
jsakamoto

Yes, you may can do it.

The Java Library "Zixing" is useful for decoding QR code images.

"Zixing" is here: github.com/zxing/zxing

Also, you can find many questions and answers about decoding QR code images on "Stack Overflow".com.

I propose to search on Google with the keyword "java how to decode qr zxing site:stackoverflow.com".