-
-
Save greene858/aadd89f27ed0d50cb0581219d9733d3c 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 jwt | |
""" note this is the PyJWT lib | |
e.g. python3 -m pip import PyJWT | |
""" | |
EXPIRATION = 9999999999 #never expire | |
AUDIENCE = "mas_dev" #MAS test group | |
SCOPE = "openid vro_mas" #MAS test scope | |
KEY = "test_key" #mock key | |
ALGORITHM = "HS256" #algorithm use in VRO | |
KEY_ID = "test_key_id" #mock key ID | |
# encode JWT with payload and headers needed for end2end test | |
encoded = jwt.encode( | |
{ | |
"exp": EXPIRATION, | |
"aud": AUDIENCE, | |
"scope": SCOPE | |
}, | |
KEY, | |
algorithm=ALGORITHM, | |
headers={"alg": ALGORITHM, "kid": KEY_ID}, | |
) | |
# output the encoded JWT | |
print(encoded) | |
# if the decoded value is needed it can be output with: | |
# decoded = jwt.decode(encoded, KEY, audience=AUDIENCE, algorithms=ALGORITHM) | |
# print(decoded) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment