Create the basic application
In this step, you will install the code you will use as the starting point for this tutorial.
The application is a fictional social network site called Kittens and Co. It currently enables you to register with a user name and password but you will improve it to support two-factor authentication (2FA) for added security.
First, ensure that you have Ruby and bundler installed by running:
Then, clone the tutorial application from its GitHub repository and run it locally:
At this point you can start the app, register for an account with a user name and password and log in and out. The application implements registration and login using Devise but most of this tutorial applies similarly to applications that use other authentication methods. Additionally, the application uses the bootstrap-sass and devise-bootstrap-templates gems for styling.
The next step is to add two-factor authentication to the registration and login process.
All the code you need to complete this tutorial is on the basic-login branch. The completed code is on the two-factor branch.
Ensure that you are on the basic-login branch before continuing. You can display the current branch in git by running:
Switch branches if necessary by executing:
Two-factor authentication for security and spam prevention
Learn how to implement 2fa in your Ruby applications