Google Authenticator compatible 2-Factor Auth in Java
This project serves as an example of how to build a 2fa support into your website or app. It is the companion code to this blog entry.
- Java 8
- Maven 3.x
- Google Authenticator app (available free in the Apple App Store and Google Play)
To complile the code and package into a jar run:
mvn clean install
To execute the example code run:
- Note the path shown for the generated QR code PNG file and open that file in your web browser (or any other image viewer).
- Use the Google Authenticator app on your mobile device to scan the QR code.
- Confirm that the 6 digit codes generated by the example code match the 6 digit codes generated by the Google Authenticator app.
- Press ctrl-c at any time to terminate the example program.
All code is licensed under the commercial-friendly BSD 2-Clause "Simplified" License.