Api for writing task 2 v1.
This commit is contained in:
17
helper/generate_jwt.py
Normal file
17
helper/generate_jwt.py
Normal file
@@ -0,0 +1,17 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user