Skip to content

This project is an authentication API using Django Rest Framework and dj-rest-auth.

Notifications You must be signed in to change notification settings

SpackiGabriel/jwt-auth-api-django-rest-framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django Rest Framework Authentication API

This project is an authentication API using Django Rest Framework and dj-rest-auth.

Available Endpoints

Register User

  • URL: api/auth/register/
  • Method: POST
  • Description: Registers a new user.
  • Example Request:
    {
      "username": "user",
      "password1": "password",
      "password2": "password",
      "email": "[email protected]"
    }

Login

  • URL: api/auth/login/
  • Method: POST
  • Description: Authenticates a user and returns access tokens.
  • Example Request:
    {
      "username": "user",
      "password": "password"
    }

Logout

  • URL: api/auth/logout/
  • Method: POST
  • Description: Logs out the authenticated user.

User Details

  • URL: api/auth/user/
  • Method: GET
  • Description: Returns details of the authenticated user.

Verify Token

  • URL: api/auth/token/verify/
  • Method: POST
  • Description: Verifies the validity of a token.
  • Example Request:
    {
      "token": "your-token"
    }

Refresh Token

  • URL: api/auth/token/refresh/
  • Method: POST
  • Description: Refreshes the access token.
  • Example Request:
    {
      "token": "your-token"
    }

Installation and Setup

  1. Clone the repository:
git clone https://github.com/your-username/your-repo-name.git
cd your-repo-name
  1. Install Poetry if you haven't already:
pip install poetry
  1. Install the dependencies:
poetry install
  1. Apply migrations:
poetry run python manage.py migrate
  1. Run the development server:
poetry run python manage.py runserver

Usage

Use a tool like Postman or httpie to interact with the API endpoints.

Releases

No releases published

Packages

 
 
 

Languages