Skip to content

adorris1/authy2fa-rails

 
 

Repository files navigation

Two-Factor Authentication with Ruby on Rails

Use Authy to add Two Factor Auth to your Rails app.

Read the full tutorial here!

Build Status

Quickstart

Create an Authy app

Create a free Authy account, if you don't have one already, and then connect it to your Twilio account.

Local development

This project is built using the Ruby on Rails web framework.

  1. First clone this repository and cd into it.

    $ git clone git@github.com:TwilioDevEd/authy2fa-rails.git
    $ cd authy2fa-rails
  2. Install the dependencies.

    $ bundle install
  3. Export the environment variables.

    You can find your Authy Api Key for Production at https://dashboard.authy.com/.

    $ export AUTHY_API_KEY=Your Authy API Key
  4. Create the database and run migrations.

    Make sure you have installed PostgreSQL. If on a Mac, I recommend Postgres.app.

    $ bundle exec rake db:setup
  5. Make sure the tests succeed.

    $ bundle exec rake test
  6. Run the server.

    $ bundle exec rails s
  7. Expose your application to the wider internet using ngrok.

You can click here for more details. This step is important because the application won't work as expected if you run it through localhost.

$ ngrok http 3000

Once ngrok is running, open up your browser and go to your ngrok URL. It will look something like this: http://9a159ccf.ngrok.io

  1. Go to your https://dashboard.authy.com. In the menu to the right you'll find the Settings. Look for OneTouch settings and update the Endpoint/URL with the endpoint you created. Something like this:

    http://[your-ngrok-subdomain].ngrok.io/authy/callback

    If you deployed this application to Heroku, the Endpoint/URL should look like this:

    http://[your-heroku-subdomain].herokuapp.com/authy/callback

Deploy to Heroku

Hit the button!

Deploy

That's it!

Meta

  • No warranty expressed or implied. Software is as is. Diggity.
  • MIT License
  • Lovingly crafted by Twilio Developer Education.

Releases

No releases published

Packages

No packages published

Languages

  • HTML 51.4%
  • Ruby 43.0%
  • CSS 2.8%
  • JavaScript 2.0%
  • CoffeeScript 0.8%