Skip to content

Latest commit

 

History

History
77 lines (50 loc) · 2.41 KB

README.md

File metadata and controls

77 lines (50 loc) · 2.41 KB
Twilio

SMS Two Factor Authentication with Sinatra and Twilio

Build and test

If for some reason you're not able to use Authy, you can implement two factor authentication yourself using SMS messages.

Read the full tutorial here!

Get started

This project is built using the Sinatra web framework.

  1. First clone this repository and cd into it.

    git clone [email protected]:TwilioDevEd/sms2fa-sinatra.git
    cd sms2fa-sinatra
  2. Install the dependencies.

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

    cp .env.example .env

    You can find your TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN in your Twilio Account Settings. You will also need a TWILIO_NUMBER, you may find here.

  4. Create development and test databases.

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

    createdb sms_two_fa_sinatra
    createdb sms_two_fa_sinatra_test
  5. Make sure the tests succeed.

    bundle exec rspec
  6. Start the server.

    bundle exec rackup
  7. Check it out at http://localhost:9292.

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.