A basic Django project demonstrating user authentication features using JWT, including user registration, login, logout, change password, and forget password functionality.
- User registration
- Login and logout functionality
- Change password
- Forget password (password reset)
The project is organized as a standard Django application. Key components include:
- Django views and URLs for authentication endpoints
- JWT-based authentication for secure, stateless session management
- User models and serializers for handling user data
Follow these steps to set up and run the project locally:
- Clone the repository:
git clone https://github.com/alimurtzaa/django-authentication.git
cd authproject- Create and activate a virtual environment:
python -m venv venv
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate- Install dependencies:
pip install -r requirements.txt- Apply database migrations:
python manage.py migrate- Create a superuser (optional, for admin access):
python manage.py createsuperuser- Run the development server:
python manage.py runserver- Access the app:
- Open your browser and go to
http://localhost:8000/
- Open your browser and go to
The project exposes endpoints for:
- User registration
- User login (returns JWT)
- User logout (JWT blacklist/expiration)
- Change password
- Forgot password (send reset instructions)
Refer to the codebase for exact endpoint URLs and request/response formats.
Note: This project provides a basic foundation for JWT-based authentication in Django. For production use, ensure to update security settings and follow best practices for handling sensitive data.