REST implementation of Django authentication system. djoser library provides a set of Django Rest Framework views to handle basic actions such as registration, login, logout, password reset and account activation. It works with custom user model.
Supported features include:
- Token-based authentication
- JWT authentication
- Social authentication
- WebAuthn support
Instead of reusing Django code (e.g. PasswordResetForm), we reimplemented
few things to fit better into Single Page App
architecture.
Developed by SUNSCRAPERS with passion & patience.
To be able to run djoser you have to meet the following requirements:
- Python>=3.9,<4.0 (including 3.10, 3.11, 3.12, and 3.13)
- Django>=3.2 (supporting Django 3.2 through 5.2)
- Django REST Framework>=3.14
Simply install using pip:
$ pip install djoserAnd continue with the steps described at configuration guide.
Documentation is available to study at
https://djoser.readthedocs.io
and in docs directory.
To start developing on djoser, clone the repository:
$ git clone [email protected]:sunscrapers/djoser.gitWe use poetry as dependency management and packaging tool.
$ cd djoser
$ poetry install --all-extrasThis will create a virtualenv with all development dependencies.
To run the test just type:
$ poetry run pytestWe also prepared a convenient Makefile to automate commands above:
$ make init
$ make testTo activate the virtual environment run
$ poetry shellNew versions of pip can use pyproject.toml to build the package and install its dependencies.
$ pip install .[test]$ cd testproject
$ ./manage.py testYou can also play with test project by running following commands:
$ make migrate
$ make runserverBefore sending patches please make sure you have pre-commit activated in your local git repository:
$ poetry run pre-commit installThis will ensure that your code is cleaned before you commit it. The pre-commit hooks will run:
- Black (code formatting)
- Ruff (linting)
- Docformatter (docstring formatting)
- Other quality checks
List of projects related to Django, REST and authentication:
Please, keep in mind that while using custom authentication and TokenCreateSerializer validation, there is a path that ignores intentional return of None from authenticate() and try to find User using parameters. Probably, that will be changed in the future.