This project is a simple Django REST API for user authentication, including signup, login, and token verification. It uses Django's built-in user model and Django REST Framework (DRF) for handling API endpoints. The project is managed using Poetry for dependency management.
- User Signup: Allows new users to create an account.
- User Login: Authenticates users and provides a token.
- Token Verification: Verifies if the provided token is valid.
- Python 3.8 or higher
- Poetry
-
Clone the repository:
git clone <repository-url> cd <repository-name>
-
Install dependencies using Poetry:
poetry install
poetry add django djangorestframework taskipy
[tools.taskipy.tasks] run = "python maange.py runserver" manage = "python manage.py" test = "python manage.py test ."
-
Apply migrations:
task manage migrate
-
Run the server:
task run
-
Run the Tests :
task tests
- URL:
/signup - Method:
POST - Description: Creates a new user and returns an authentication token.
- Request Body:
{ "username": "your_username", "password": "your_password", "email": "your_email@example.com" } - Response:
{ "token": "your_token", "user": { "id": 1, "username": "your_username", "email": "your_email@example.com" } }
- URL:
/login - Method:
POST - Description: Authenticates a user and returns an authentication token.
- Request Body:
{ "username": "your_username", "password": "your_password" } - Response:
{ "token": "your_token", "user": { "id": 1, "username": "your_username", "email": "your_email@example.com" } }
- URL:
/test_token - Method:
GET - Description: Verifies if the provided token is valid.
- Headers:
Authorization: Token your_token - Response:
{ "message": "passed for the email : your_email@example.com" }
This project is licensed under the MIT License. See the LICENSE file for details.