two-factor-auth-FastAPI
two-factor-auth-FastAPI copied to clipboard
Two Factor Authentication (2FA) using FastAPI
Two Factor Authentication using FastAPI
This repository uses FastAPI for creating webapp and PyOTP Python library is used for generating and verifying one-time passwords.
Installation
Local
git clone https://github.com/vinodiOS/two-factor-auth-FastAPI.git
cd two-factor-auth-FastAPI
virtualenv venv
source env/bin/activate
pip install -r requirements.txt
uvicorn main:app --reload
Container with docker
docker-compose up
Steps for setting up Two Factor Authentication
Follow next steps for setting up user account and generate TOTP using Authenticator app.
Signup
Enter the following path to create new user.
http://127.0.0.1:8000/signup/
QR Code Generation
After entering appropriate details new user would be created and page will be navigated to QR Code.
Authenticator app setup
Use Google Authenticator or Microsoft Authenticator or any other Authenticator app to scan QR code and generate TOTP.
Login
Follow this path to login
http://127.0.0.1:8000/login/
Enter user credentials along with 6 digit TOTP generated by Authenticator app.
And, welcome to your website. You have securely logged into your account.
Please star ✨ repository if you like it. Thank you!