https://github.com/nexmo/ruby-2fa
Two Factor Authentication with Nexmo Verify
https://github.com/nexmo/ruby-2fa
tutorial
Last synced: 7 months ago
JSON representation
Two Factor Authentication with Nexmo Verify
- Host: GitHub
- URL: https://github.com/nexmo/ruby-2fa
- Owner: Nexmo
- License: mit
- Created: 2016-08-16T16:14:26.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2025-05-01T07:40:21.000Z (9 months ago)
- Last Synced: 2025-05-22T22:06:19.460Z (9 months ago)
- Topics: tutorial
- Language: Ruby
- Homepage: https://developer.nexmo.com/tutorials/two-factor-authentication
- Size: 37.1 KB
- Stars: 1
- Watchers: 18
- Forks: 4
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Two Factor Authentication with Nexmo Verify
A Rails (Ruby) app showing how to implement two-factor authentication using the Nexmo Verify API.
## Prerequisites
* [A Nexmo account](https://dashboard.nexmo.com/sign-up)
* [Ruby 2.1+](https://www.ruby-lang.org/) and [Bundler](http://bundler.io/) installed
* [Rails 5+](http://rubyonrails.org/) installed
## Getting started
```sh
# clone this repository
git clone git@github.com: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.
```sh
rails server
```
## Usage
This app shows you how to secure your app login with two-factor authentication using [Rails](http://rubyonrails.org/), Ruby and [Nexmo Verify](https://www.nexmo.com/products/verify/).
Once your server is started:
* Visit [localhost:3000](http://localhost:3000/)
* Register for an account
* The phone number must be provided without any leading 0's or +'s (e.g. `445555666777`)
* 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
## License
This project is licensed under the [MIT license](LICENSE).