Created
March 29, 2023 06:37
-
-
Save yalin/be1b5b6309371ecef8b92b414511e410 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
import os | |
import jwt | |
from dotenv import load_dotenv | |
load_dotenv() # take environment variables from .env. | |
secret_key = os.getenv("TOKEN_SECRET_KEY") | |
secret_name= os.getenv("TOKEN_SECRET_NAME") | |
payload = { | |
"sub": secret_name, | |
} | |
token = jwt.encode(payload, secret_key, algorithm="HS256") | |
print(token) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment