A Rails (Ruby) app showing how to implement two-factor authentication using the Nexmo Verify API.
- A Nexmo account
- Ruby 2.1+ and Bundler installed
- Rails 5+ installed
# clone this repository
git clone [email protected]:Nexmo/ruby-2fa.git
# change to folder
cd ruby-2fa
# install dependencies
bundle install
# create a .env
cp .env.example .env
Next you will need to sign up for a Nexmo account and get your API credentials from the API dashboard and put them in your .env
file.
Finally all that's left is to start the server.
rails server
This app shows you how to secure your app login with two-factor authentication using Rails, Ruby and Nexmo Verify.
Once your server is started:
- Visit localhost:3000
- Register for an account
- The phone number must be provided without any leading 0's or +'s (e.g.
445555666777
)
- The phone number must be provided without any leading 0's or +'s (e.g.
- You will receive a code in a few seconds, fill this in on the second form and submit
- You will now be registered and logged in
- Logout and in again to see the same in action for login
This project is licensed under the MIT license.