https://github.com/obaraelijah/django-2factor-authentication
Implementing 2-Factor Authentication in Django&DRF
https://github.com/obaraelijah/django-2factor-authentication
2fauth django django-rest-framework docker
Last synced: 11 months ago
JSON representation
Implementing 2-Factor Authentication in Django&DRF
- Host: GitHub
- URL: https://github.com/obaraelijah/django-2factor-authentication
- Owner: obaraelijah
- Created: 2023-08-23T12:34:47.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-08-24T14:09:03.000Z (almost 3 years ago)
- Last Synced: 2024-12-03T09:12:07.668Z (over 1 year ago)
- Topics: 2fauth, django, django-rest-framework, docker
- Language: Python
- Homepage:
- Size: 274 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Django - DRF 2factor Authentication using an Authenticator App
👋This guides how to implement two-factor authentication in Django & DRF using Authenticator Apps
Complete guide [Medium](https://medium.com/@elijahobara/django-rest-api-protection-via-2fa-two-factor-authentication-bbeab8d26100)
## Tools & Services:
- Django & DRF : for building the APIs
- Docker & Docker compose: Containerization
- PostgreSQL: Relational DB
## By the end of this tutorial
- Understand how Two-Factor Authentication (2FA) works.
- Onboard a user on the system
- Generate a QR code for the user
- Enable users to make a login attempt using valid credentials, such as their email and password.
- Authenticate the user using an offline OTP generated by an Authenticator App.
## Running locally
Create a .env file by copying the .env.sample provided and run:
```
docker compose build && docker compose up
```
to start the container. As an alternative, run:
```
docker-compose -f docker-compose.dev.yml up --build
```
to build and run the container using the dev yaml file.
Make sure to externalize the db instance to be used. It can be in another container.
## Run tests
Run descriptive tests in the container using:
```
docker compose exec pytest -rP -vv
```
Access the docs on:
```
http://localhost:8000/api/v1/doc
```
# Doc

# QR code

# Test
