Django Rest Framework Simple JWT

Django rest framework with access and refresh token.
Django rest framework simple jwt doc here.
Django rest framework doc here.

API Access with JWT

Step 1: Preparation, Create Django Project, Initial Migration
create virtualenv: virtualenv venv
start virtualenv: venv/Scripts/activate
install Django in virtualenv: pip install django==3.0
install drf: pip install djangorestframework
install drf simplejwt: pip install djangorestframework_simplejwt
Create Django: django-admin startproject myproject
Go to myproject folder: cd myproject
Initial Migration: python migrate

Step 2: Create App and Add Django Rest Framework in Project Setting
Create apps: python startapp myapp
Add myapp and rest_framework into INSTALLED_APPS in myproject/

Step 3: Set Up Rest Framework Authentication
Add rest framework authentication code into

Step 4: Add APIView Class in
update myapp/

Step 5: Setup URLs in myapp and myproject Folder
update myproject/

add myapp/

Step 6: Create Superuser
Create superuser: python createsuperuser
Type username, email password and retype password

Step 7: Run Server and Testing
Run Server: python runserver

Test using POSTMAN

Get Access and Refresh Token
method POST:
Body with username and username that created before

Refresh Token
method POST:
Body with username, password and refresh token to get access token

Test get with Access Token
method GET:



Software Engineer, Indonesia

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store