An example of a basic two factor authentication system using python, flask, and Bandwidth's API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
templates
.gitignore
README.md
app.py
requirements.txt

README.md

Python Two-Factor Authentication

An example application of how to build a Two-Factor-Authentication system using python, flask, and Bandwidth's API.

This application demonstrates how to authenticate a user using a phone call and keypad inputs.

Table of Contents

Prereqs

How It Works

Run

pip install -r requirements.txt

to install dependencies.

Set the following environmental variables:

FLASK_SECRET_KEY
BANDWIDTH_USER_ID
BANDWIDTH_API_TOKEN
BANDWIDTH_API_SECRET
BANDWIDTH_PHONE_NUMBER

Run

python app.py

to launch the server. You can view the website at localhost:5000.

The website displays a basic user login and user register page. In order to register, a user needs a username, password, and phone number. After the user registers, they will receive a phone call and be asked to input the secret 4 digit code displayed on the website. Successfully inputting this code will register the user, otherwise the registration will fail.

In order to login, a user needs to input their username and password. If the username and password combination is correct, the user will receive a phone call and be asked to press 1 to authenticate the login. If the user presses 1, the login will succeed, otherwise the login will fail.