django rest frmaework simplejwt auth and vuejs & vuex

Gantadurgarao
1 min readDec 7, 2020

--

Simple JWT provides a JSON Web Token authentication backend for the Django REST Framework.

https://github.com/Durgarao310/fullstack-drf-vue-vuex

token format like this :

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9 ->

HEADER:ALGORITHM & TOKEN TYPE : The header typically consists of two parts: the type of the token, which is JWT, and the signing algorithm being To create the signature part you have to take the encoded header, the encoded payload, a secret, the algorithm specified in the header, and sign that.To create the signature part you have to take the encoded header, the encoded payload, a secret, the algorithm specified in the header, and sign that.used, such as HMAC SHA256 or RSA.

{
“alg”: “HS256”,
“typ”: “JWT”
}

eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ ->

PAYLOAD:DATA : The second part of the token is the payload, which contains the claims. Claims are statements about an entity (typically, the user) and additional data. There are three types of claims: registered, public, and private claims.

{
“sub”: “1234567890”,
“name”: “John Doe”,
“iat”: 1516239022
}

SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c ->VERIFY SIGNATURE : To create the signature part you have to take the encoded header, the encoded payload, a secret, the algorithm specified in the header, and sign that.

HMACSHA256(
base64UrlEncode(header) + “.” +
base64UrlEncode(payload),
)
secret base64 encoded

--

--