A Django-based web application that implements traditional authentication (username/password) and passkey authentication using the WebAuthn API. Passkey authentication allows users to securely log in without passwords, using biometric or hardware-based authentication methods.
- User Registration and Login:
- Traditional username/password registration and login.
- Integrated Django's built-in authentication system.
- Passkey Authentication:
- Users can register and log in using passkeys, enabling passwordless authentication.
- Implements the WebAuthn API for secure authentication.
- Secure Development Practices:
- Uses Django's CSRF protection.
- Ready for deployment with HTTPS support for secure contexts.
This guide will help you set up and run the Django Passkey Authentication project on your local machine.
- Python 3.8 or later
- Django 4.0 or later
- Modern web browser that supports WebAuthn (e.g., Chrome, Firefox, Edge)
- HTTPS for secure passkey functionality (required for production)
git https://github.com/yokwejuste/django-passkeys.git django-passkey-auth
cd django-passkey-auth
python -m venv venv
source venv/bin/activate # On Windows: .\venv\Scripts\activate
pip install -r requirements.txt
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver
Access the app at http://localhost:8000
.
- Navigate to
/register/
. - Fill out the registration form to create a user account.
- Navigate to
/#/
. - Enter your username and password to log in.
- Log in with your username and password.
- Navigate to
/register-passkey/
. - Click "Register Passkey" and follow the prompts to register your passkey.
- Navigate to
/#/
. - Click "Login with Passkey" and authenticate using your registered passkey.
/auth/register/ - Register a new user
/auth/#/ - Login with username/password
/auth/logout/ - Log out the current user
/auth/register-passkey/ - Register a passkey for the user
/auth/#/ (POST) - Log in using passkey authentication
django-passkey-auth/
├── auth_app/
│ ├── migrations/
│ ├── templates/
│ │ ├── auth_app/
│ │ ├── home.html
│ │ ├── login.html
│ │ ├── register.html
│ ├── forms.py
│ ├── views.py
│ ├── urls.py
├── fido_auth/
│ ├── migrations/
│ ├── templates/
│ │ ├── fido_auth/
│ │ ├── register_passkey.html
│ │ ├── login.html
│ ├── models.py
│ ├── views.py
│ ├── urls.py
├── passkey_auth_project/
│ ├── settings.py
│ ├── urls.py
│ ├── wsgi.py
│ ├── asgi.py
├── manage.py
├── requirements.txt
├── README.md
- Use HTTPS: Passkey authentication requires a secure context. Use HTTPS for your deployment.
- Configure Allowed Hosts: Set
ALLOWED_HOSTS
insettings.py
to include your domain. - Secure Cookies: Ensure CSRF and session cookies are marked as
Secure
.
This project is licensed under the MIT License. See the LICENSE
file for details.