micropub_server/tools/decode_token.py

17 lines
380 B
Python

import jwt
import sys
if len(sys.argv) != 2:
print("Usage: python decode_jwt.py <JWT_TOKEN>")
sys.exit(1)
token = sys.argv[1]
try:
# Decode the token without verifying the signature
decoded = jwt.decode(token, options={"verify_signature": False})
print("Decoded JWT:")
print(decoded)
except jwt.DecodeError as e:
print(f"Failed to decode JWT: {e}")