Skip to content

Latest commit

 

History

History
65 lines (40 loc) · 2.05 KB

README.md

File metadata and controls

65 lines (40 loc) · 2.05 KB

Two-Factor Authentication with Ruby and Sinatra

This example application demonstrates how to use Authy as the two-factor authentication provider using Authy and Sinatra.

Build and test

Get started

  1. First clone this repository and cd into it

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

    bundle
    
  3. Copy the sample configuration file and edit it to match your configuration.

    cp .env.example .env
  4. Make sure the tests succeed

    $ bundle exec rake
    
  5. Run the application

    $ bundle exec rackup
  6. To enable Authy OneTouch to use the callback endpoint you exposed, your development server will need to be publicly accessible. We recommend using ngrok to solve this problem.

    $ ngrok http 9292
  7. Go to your Twilio Console and register the callback endpoint under your Authy app's Push Authentication. Your endpoint will look like http://[your-subdomain].ngrok.io/authy/callback.

  8. Check it out at http://[your-subdomain].ngrok.io

That's it!

Configure Development vs Production Settings

By default, this application will run in production mode - stack traces will not be visible in the web browser. If you would like to run this application in development locally, change the APP_ENV variable in your .env file.

APP_ENV=development

For more about development vs production, visit Sinatra's configuration page.

Meta

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