Skip to content

asaph/twofactorauth

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

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.

About

Google Authenticator compatible 2-Factor Auth in Java

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages