Google Authenticator compatible 2-Factor Auth in Java
Java
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src/main/java/org
.gitignore
LICENSE
README.md
pom.xml

README.md

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.

Requirements:

  • Java 8
  • Maven 3.x
  • Google Authenticator app (available free in the Apple App Store and Google Play)

Building

To complile the code and package into a jar run:

mvn clean install

Running

To execute the example code run:

mvn exec:java
  1. Note the path shown for the generated QR code PNG file and open that file in your web browser (or any other image viewer).
  2. Use the Google Authenticator app on your mobile device to scan the QR code.
  3. Confirm that the 6 digit codes generated by the example code match the 6 digit codes generated by the Google Authenticator app.
  4. Press ctrl-c at any time to terminate the example program.

License

All code is licensed under the commercial-friendly BSD 2-Clause "Simplified" License.