Files
encoach_backend/helper/generate_jwt.py
2023-06-19 23:38:47 +01:00

18 lines
318 B
Python

import jwt
import os
from dotenv import load_dotenv
load_dotenv()
# Define the payload (data to be included in the token)
payload = {'sub': 'test'}
# Define the secret key
secret_key = os.getenv("JWT_SECRET_KEY")
# Generate the JWT
jwt_token = jwt.encode(payload, secret_key, algorithm='HS256')
print(jwt_token)