This package provides functionality to generate a JWT in Python code.
It is used by the Vonage Python SDK.
Install from the Python Package Index with pip:
pip install vonage-jwt
This JWT Generator can be used implicitly, just by using the Vonage Python SDK to make JWT-authenticated API calls.
It can also be used as a standalone JWT generator for use with Vonage APIs, like so:
from vonage_jwt.jwt import JwtClient
jwt_client = JwtClient(application_id, private_key)
jwt_client.generate_application_jwt()
Optional JWT claims can be provided in a python dictionary:
claims = {'jti': 'asdfzxcv1234', 'nbf': now + 100}
jwt_client.generate_application_jwt(claims)
You can use the verify_jwt.verify_signature
method to verify a JWT signature is valid.
from vonage_jwt.verify_jwt import verify_signature
verify_signature(TOKEN, SIGNATURE_SECRET) # Returns a boolean