Creating id_token with Python
Sample Code to generate a id_token using Python
import jwt #pip install pyjwt[crypto]
from datetime import timedelta, datetime, timezone
privateKey = open("<env><partner_name>privatekey.pem", "r").read()
encoded_jwt = jwt.encode({ "stockal_username": '<stockal-customer-id>', "iss": "<YOUR_PARTNER_CODE>", "aud": ["stockal.com"] , "exp" : datetime.now() + timedelta(minutes=1) }, privateKey, algorithm="RS512")
print(encoded_jwt)
Updated almost 3 years ago