/django-react-auth

startup fast with your app using this repo having jwt auth / react / DRF / CORS already setup and configured

Primary LanguagePython

Notes API (Django & React)

You can make notes using this API to store ideas from your lectures or reading. It will make revision easy and clarify your thinking.

Frontend (React)

Frontend is developed using ReactJS library. The UI is kept simple just to demonstrate the functionality of the app.

Backend (Django)

Backend is developed using DRF (Django Rest Framework) using both class based views (for tokenization) and function based views (for CRUD operation on Notes).

Badges

GitHub issues GitHub forks GitHub stars

JWT Authentication Features

  • Access token valid for 5000ms
  • Generate a new access token using refresh token before expiry
  • Refresh token rotation lifespan 90 days
  • Previous refresh tokens are blacklisted after rotation so save the new refresh token each time after rotation
  • Encryption algorithm used HS256
  • For Authorization use 'Bearer {access token}' as value
  • Token claim has been customized to add additional field 'username'. You can retrieve 'username' by jwt decoding either refresh or access token

API Reference

Base URL :

  https://clean-orangutan-healthslash-3ca3ec8a.koyeb.app/

Get all endpoints

  GET /api/

Signup to a create new user

  POST /api/create-user/
Parameter Type Description
username string Required. username should be unique field
password string Required. password any format is acceptable

Login for existing users

  POST /api/token/
Parameter Type Description
username string Required. existing username
password string Required. existing password

Generate new tokens (tokens expire every 5000ms)

  POST /api/token/refresh/
Parameter Type Description
refresh string Required. latest refresh token

Retrieve array of user notes

  GET /api/notes/
Parameter Type Description
access string Required. latest access token

Create a new note

  POST /api/create-notes/
Parameter Type Description
access string Required. latest access token to authenticate
body string Required. add content of note in 'body' key
  DELETE /api/delete-notes/{id}/
Parameter Type Description
access string Required. latest access token to authenticate
id string Required. id of note to be deleted
  PATCH /api/update-notes/{id}/
Parameter Type Description
access string Required. latest access token to authenticate
id string Required. id of note to be be updated

Deployment

This project is running on @docker containers deployed on @DigitalOcean droplet and managed by @NGINX reverse proxy (depreciated).

Currently, running on https://www.koyeb.com/ free instance.

Author

Zaeem Akhtar