{"id":22261032,"url":"https://github.com/obaraelijah/django-2factor-authentication","last_synced_at":"2025-08-21T19:19:51.312Z","repository":{"id":190178415,"uuid":"682095551","full_name":"obaraelijah/django-2factor-authentication","owner":"obaraelijah","description":" Implementing 2-Factor Authentication in Django\u0026DRF","archived":false,"fork":false,"pushed_at":"2023-08-24T14:09:03.000Z","size":281,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-03T09:12:07.668Z","etag":null,"topics":["2fauth","django","django-rest-framework","docker"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/obaraelijah.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-23T12:34:47.000Z","updated_at":"2024-08-07T08:08:56.000Z","dependencies_parsed_at":"2024-12-03T09:11:24.886Z","dependency_job_id":"79688547-c4e1-4c03-bec0-f0adbf5ba08b","html_url":"https://github.com/obaraelijah/django-2factor-authentication","commit_stats":null,"previous_names":["obaraelijah/django-2factor-authentication"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obaraelijah%2Fdjango-2factor-authentication","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obaraelijah%2Fdjango-2factor-authentication/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obaraelijah%2Fdjango-2factor-authentication/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obaraelijah%2Fdjango-2factor-authentication/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/obaraelijah","download_url":"https://codeload.github.com/obaraelijah/django-2factor-authentication/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236346971,"owners_count":19134568,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["2fauth","django","django-rest-framework","docker"],"created_at":"2024-12-03T09:11:14.666Z","updated_at":"2025-01-30T12:22:59.716Z","avatar_url":"https://github.com/obaraelijah.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Django - DRF 2factor Authentication using an Authenticator App\n\n\u003cp\u003e\n  \u003ca href=\"https://twitter.com/talkcoding\" target=\"_blank\"\u003e\n    \u003cimg alt=\"Twitter: talkcoding\" src=\"https://img.shields.io/twitter/follow/Talkcoding.svg?style=social\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n👋This guides how to implement two-factor authentication in Django \u0026 DRF using Authenticator Apps \u003cbr\u003e\nComplete guide [Medium](https://medium.com/@elijahobara/django-rest-api-protection-via-2fa-two-factor-authentication-bbeab8d26100)\n\n## Tools \u0026 Services:\n- Django \u0026 DRF : for building the APIs\n- Docker \u0026 Docker compose: Containerization\n- PostgreSQL: Relational DB\n\n\n\n## By the end of this tutorial \n- Understand how Two-Factor Authentication (2FA) works.\n- Onboard a user on the system\n- Generate a QR code for the user\n- Enable users to make a login attempt using valid credentials, such as their email and password.\n- Authenticate the user using an offline OTP generated by an Authenticator App.\n\n\n## Running locally\n\nCreate a .env file by copying the .env.sample provided and run:\n```\ndocker compose build \u0026\u0026 docker compose up\n```\nto start the container. As an alternative, run:\n```\ndocker-compose -f docker-compose.dev.yml up --build\n```\nto build and run the container using the dev yaml file.\nMake sure to externalize the db instance to be used. It can be in another container.\n\n## Run tests\nRun descriptive tests in the container using:\n```\ndocker compose exec \u003cdocker_container_name\u003e pytest -rP -vv\n```\n\nAccess the docs on:\n\n```\nhttp://localhost:8000/api/v1/doc\n```\n\n\n# Doc\n![Screenshot](screenshot1.png)\n\n# QR code\n![Screenshot](screenshot2.png)\n\n# Test\n![Screenshot](screenshot3.png)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobaraelijah%2Fdjango-2factor-authentication","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fobaraelijah%2Fdjango-2factor-authentication","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobaraelijah%2Fdjango-2factor-authentication/lists"}