Skip to content

A simple implementation of a Twilio Account Security protected site using Python and Flask.

License

Notifications You must be signed in to change notification settings

TwilioDevEd/account-security-quickstart-flask

Repository files navigation

Twilio

Twilio Account Security Quickstart - Two-Factor Authentication and Phone Verification

Build Status

A simple Python and Flask implementation of a website that uses Twilio Account Security services to protect all assets within a folder. Additionally, it shows a Phone Verification implementation.

It uses four channels for delivery, SMS, Voice, Soft Tokens, and Push Notifications. You should have the Authy App installed to try Soft Token and Push Notification support.

Two-Factor Authentication Demo

  • URL path "/protected" is protected with both user session and Twilio Two-Factor Authentication
  • One Time Passwords (SMS and Voice)
  • SoftTokens
  • Push Notifications (via polling)

Phone Verification

  • Phone Verification
  • SMS or Voice Call

Setup

This project is built using the Flask web framework. It runs on Python 2.7+ and Python 3.4+.

  1. To run the app locally, first clone this repository and cd into it.

  2. Create and activate a new python3 virtual environment.

    python3 -m venv venv
    source venv/bin/activate
  3. Install the requirements using pip.

    pip install -r requirements.txt
  4. Copy the .env.example file to .env, and edit it to add your Application API Key. Can get/create one here.

    ACCOUNT_SECURITY_API_KEY=<your API key>
    
  5. Create Flask application variables for development

    export FLASK_APP=twofa 
    export FLASK_ENV=development
  6. Run the migrations.

    flask db upgrade
  7. Start the development server.

    flask run

Meta

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

About

A simple implementation of a Twilio Account Security protected site using Python and Flask.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published