This project implements a Django-based authentication system with cookie-based authentication, user registration, login, and protected endpoints. It also includes Swagger API documentation.
- User registration with email and password.
- OTP verification for registration.
- User login with email and password.
- Protected endpoint to retrieve logged-in user details.
- Logout functionality.
- Swagger API documentation.
- Python 3.8 or higher
- pip (Python package manager)
git clone https://github.com/krishpranav/api_task.git
cd api_task
python3 -m venv venv
- On macOS/Linux:
source venv/bin/activate
- On Windows:
venv\Scripts\activate
python3 -m pip install -r requirements.txt
python3 manage.py migrate
python3 manage.py runserver
- Swagger UI: Open
http://127.0.0.1:8000/swagger/
to explore and test the API.
- POST /api/register/: Register a new user.
- POST /api/register/verify/: Verify OTP for registration.
- POST /api/login/: Log in a user.
- GET /api/me/: Retrieve details of the logged-in user.
- POST /api/logout/: Log out the user.