intro

Handy cripts for jwt related works

import jwt
import time
from datetime import datetime, timedelta

key = "key"

# claims
claims = {
    "email": "email",
    "role": ["role1"],
    "exp": int((datetime.utcnow() + timedelta(hours=72)).timestamp()),
    "iss": "issuer-uri",
    "aud": "audience"
}

# encoding
token = jwt.encode(claims, key, algorithm="HS512")
print(token)