Files
encoach_backend/helper/generate_jwt.py
Cristiano Ferreira 6e2355ee4c Clean up the code.
2024-04-10 22:21:30 +01:00

18 lines
318 B
Python

import os
import jwt
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)