Passkey authentication for Django
Project description
Note that this is very much not a finished package. Consider it a tech demo, or a small proof of concept, and feel free to use it however you'd like, but I would not recommend using it in production as-is.
Installation
pip install django-passkey-auth
- Add
passkeys
to yourINSTALLED_APPS
setting - Include
passkeys.urls
somewhere in yoururls.py
(auth/passkey/
for example) - Migrate your database
Integration with the Django admin
django-passkey-auth
comes with some basic admin template overrides that make it
possible to register and authenticate with a passkey to the Django admin. To use these
customizations, add passkeys.template_directory
to your TEMPLATES["DIRS"]
list.
The next time you log into the admin, a "Register Passkey" link will be available in the user links at the top. Once you have registered a passkey, you can use the "Passkey Login" button available on the admin login form.
Integration with your site
- Add
<script src="{% static 'passkeys/passkeys.js' %}" defer></script>
to your login page, and any page where you may want to allow users to register a passkey. - Add a button to allow users to register a passkey:
<button onclick="registerPasskey('{% url "passkey-register" %}', '{% url "home" %}')">Register Passkey</button>
- Add a button to your login page to allow users to authenticate with a passkey:
<button onclick="authenticatePasskey('{% url "passkey-login" %}', '{% url "home" %}')">Passkey Login</button>
Javascript functions
The passkeys.js
script contains two functions:
async function registerPasskey(endpoint, redirect)
async function authenticatePasskey(endpoint, redirect)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django_passkey_auth-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d89baf63dd2e267ade43758f36ceb7431ce2b06ccc5729c266595edf136a346 |
|
MD5 | 786469ec70bcc5beb79d0df8896c8390 |
|
BLAKE2b-256 | f0e98f38440f792b130e4e6087a9baf0f62bcb890388cf734eca5b14e2b3f2d2 |
Hashes for django_passkey_auth-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fac716291ea118e846b8fa4f39c09d53b97649765a9d6f615f14f6e6ec35e296 |
|
MD5 | a71f50723031fd568c39c8f7b15799c5 |
|
BLAKE2b-256 | 063da650ec604555d1a692b42b40eb3ee9386182bf8ff0c5f153f12aca7ccee0 |