User Authentication APIs using Django Rest Framework (DRF). It provides a flexible and secure users authentication endpoints for your Django applications.
- Token-based authentication with Http-Cookies.
- Username or Email authentication.
- User registration and profile management.
- User login and logout functionality.
- User recover password with their email address.
- User reset email address to their new email.
- Git - Download from Here
- Python - Download from Here
User Registration API
POST /api/user/register/
Content-Type: application/json
{
"username": "john_doe",
"email": "[email protected]",
"password": "John@1980"
}
User Login API
POST /api/user/login/
Content-Type: application/json
{
"username": "username_or_email",
"password": "your_password"
}
API Endpoints | User | ||
---|---|---|---|
Anonymous User | Authenticated User | ||
api/user/register/ | POST | - | |
api/user/login/ | POST | - | |
api/user/logout/ | - | GET | |
api/user/account/confirm/token/ | POST | - | |
api/user/account/reset-password/ | POST | POST | |
api/user/account/reset-password/confirm/token/ | UPDATE | UPDATE | |
api/user/account/email/reset/ | - | POST | |
api/user/account/email/confirm/token/ | - | UPDATE | |
api/user/account/password/change/ | - | UPDATE | |
api/user/account/profile | - | GET, UPDATE |
git clone https://github.com/anuraagnagar/django-authentication-API.git
cd django-authentication-API
python -m venv venv
source venv/bin/activate # On MacOS/Linux
venv\Scripts\activate # On Windows
pip install -r requirements.txt
Before running migrations and starting the development server, make sure to duplicate the .env.example
file as .env
in your project's root directory, and then fill all the necessary details for all the environment variables within the .env
file."
python manage.py migrate
python manage.py runserver
Visit http://localhost:8000/ in your browser for access this application.
This project is licensed under the MIT License - see the LICENSE file for details.