This example application demonstrates how to use Authy as the two-factor authentication provider using Authy and Sinatra.
-
First clone this repository and
cd
into it$ git clone https://github.com/TwilioDevEd/authy2fa-sinatra.git $ cd authy2fa-sinatra
-
Install the dependencies
bundle
-
Copy the sample configuration file and edit it to match your configuration.
cp .env.example .env
-
Make sure the tests succeed
$ bundle exec rake
-
Run the application
$ bundle exec rackup
-
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
-
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
. -
Check it out at http://[your-subdomain].ngrok.io
That's it!
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.
- No warranty expressed or implied. Software is as is. Diggity.
- MIT License
- Lovingly crafted by Twilio Developer Education.