18 lines
318 B
Python
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)
|