An open API service indexing awesome lists of open source software.

https://github.com/achingachris/django-rest-authentication

Django Rest Framework Authentication APIs
https://github.com/achingachris/django-rest-authentication

Last synced: about 1 month ago
JSON representation

Django Rest Framework Authentication APIs

Awesome Lists containing this project

README

          

# Django Rest Authentication

## Overview
Django Rest Authentication is a Django-based project focused on providing authentication functionalities for RESTful APIs.
It leverages Django's robust framework and extends it to handle API authentication effectively.

## Features
- **User Registration and Login**: Implements endpoints for user registration and login, ensuring secure access to the application.
- **Email Verification**: Supports email verification for registered users, enhancing the security and integrity of user data.
- **Password Reset**: Provides a password reset mechanism, allowing users to recover their accounts securely.

## Requirements
The project requires various dependencies listed in `requirements.txt`, including Django, Django REST framework, and other related packages. Ensure these are installed to run the project successfully.

## Configuration
- **Settings**: Configured in `config/settings.py`, including database settings, installed apps, middleware, and more.
- **URL Routing**: Defined in `config/urls.py`, routing the authentication-related endpoints.

## Authentication App
- **Models**: Located in `authentication/models.py`, though currently, it does not contain custom models.
- **Views**: Custom views in `authentication/views.py` handle specific authentication-related functionalities like email confirmation redirection.
- **URLs**: The `authentication/urls.py` file defines the URL patterns for authentication-related actions, including registration, login, logout, and password reset.

## Running the Project
Use `manage.py` to run administrative tasks, including starting the server. Ensure the Django environment is properly set up before running the project.

---

This README provides a basic overview of the Django Rest Authentication project. For more detailed information, refer to the specific files in the repository.

[View the Django Rest Authentication Repository](https://github.com/achingachris/django-rest-authentication)

---

# Testing Documentation for Django Rest Authentication APIs

This documentation provides guidelines on how to test the available APIs in the Django Rest Authentication project. The project includes several key functionalities such as user registration, login, logout, email verification, and password reset.

## Setting Up the Testing Environment

1. **Install Dependencies**: Ensure all required packages listed in `requirements.txt` are installed in your virtual environment.

2. **Database Setup**: The project uses SQLite by default. Make sure the database is set up and migrated using Django's `manage.py migrate` command.

3. **Running the Server**: Start the Django development server using `manage.py runserver`.

## Testing Tools

You can use tools like Postman, cURL, or any HTTP client to test the APIs. Automated tests can also be written using Django's test framework.

## API Endpoints

### 1. User Registration

- **Endpoint**: `/api/auth/register/`
- **Method**: `POST`
- **Payload**:
```json
{
"username": "user",
"email": "user@example.com",
"password1": "yourpassword",
"password2": "yourpassword"
}
```
- **Expected Response**: A success message with user details.

### 2. Email Verification

- **Endpoint**: `/api/auth/register/verify-email/`
- **Method**: `POST`
- **Payload**:
```json
{
"key": "verification-key"
}
```
- **Expected Response**: Verification success message.

### 3. Login

- **Endpoint**: `/api/auth/login/`
- **Method**: `POST`
- **Payload**:
```json
{
"username": "user",
"password": "yourpassword"
}
```
- **Expected Response**: Token and user details.

### 4. Logout

- **Endpoint**: `/api/auth/logout/`
- **Method**: `POST`
- **Headers**: `Authorization: Token `
- **Expected Response**: Logout success message.

### 5. User Details

- **Endpoint**: `/api/auth/user/`
- **Method**: `GET`
- **Headers**: `Authorization: Token `
- **Expected Response**: User details.

### 6. Password Reset

- **Endpoint**: `/api/auth/password/reset/`
- **Method**: `POST`
- **Payload**:
```json
{
"email": "user@example.com"
}
```
- **Expected Response**: Password reset email sent message.

### 7. Password Reset Confirm

- **Endpoint**: `/api/auth/password/reset/confirm///`
- **Method**: `POST`
- **Payload**:
```json
{
"new_password1": "newpassword",
"new_password2": "newpassword"
}
```
- **Expected Response**: Password reset success message.

## Notes

- Replace ``, ``, and `` with actual values received during testing.
- For email verification and password reset, you will need to extract the verification key, uidb64, and token from the email sent to the user.
- Ensure the server is running and accessible during testing.
- Use appropriate headers and payload formats as per your testing tool.

---