reading-notes

Software Development Reading Notes

View on GitHub

JSON Web Token

Json web token are used to identify an authenticated user. It is issued by an authentication server and consumed by a client server.

Scenarios that using JWT:

JWT structure

How JWT works?

A JWT returned after logged in. Avoid expose it to public unnecessarily. when user need it to access to protected sources, send JWT using the Bearer schema, server will check it after and give access permission accordingly.

Why JWT? VS SWT, SAML

use JWT with Django REST Framework

1, pip install djangorestframework_simplejwt

2, modify Django settings.py

3, modify urls.py in app level

4, usage: Obtain token; refresh token

Django Runserver Is Not Your Production Server

DO NOT USE THIS SERVER IN A PRODUCTION SETTING. It has not gone through security audits or performance tests.
--Django Doc

Runserver is designed to just for project testing purpose, it’s slow and insecure. In real world production deployment, we need professional servers: webserver like Apache, Nginx; application servers like WSGI and .net framework for example.

Things I want to know more?

JWT Django project implementation in details.