Skip to main content

Tooling for working with JWTs for Vonage APIs in Python.

Project description

Vonage JWT Generator for Python

This package (vonage-jwt) provides functionality to generate a JWT in Python code.

It is used by the Vonage Python SDK, specifically by the vonage-http-client package, to generate JWTs for authentication. Thus, it doesn't require manual installation or configuration unless you're using this package independently of an SDK.

For full API documentation, refer to the Vonage developer documentation.

Installation

Install from the Python Package Index with pip:

pip install vonage-jwt

Generating JWTs

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:

Import the JwtClient object

from vonage_jwt import JwtClient

Create a JwtClient object

jwt_client = JwtClient(application_id, private_key)

Generate a JWT using the provided application id and 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)

Verifying a JWT signature

You can use the verify_jwt.verify_signature method to verify a JWT signature is valid.

from vonage_jwt import verify_signature

verify_signature(TOKEN, SIGNATURE_SECRET) # Returns a boolean

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vonage_jwt-1.1.3.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

vonage_jwt-1.1.3-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file vonage_jwt-1.1.3.tar.gz.

File metadata

  • Download URL: vonage_jwt-1.1.3.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.4

File hashes

Hashes for vonage_jwt-1.1.3.tar.gz
Algorithm Hash digest
SHA256 a80c3050a9b0b10ef2338e04d3c54e5dde5eea2ae6a2dd1b130ea6951c847708
MD5 86530a8f079c93ff1910f36e2b58c673
BLAKE2b-256 6600c2c60feedd59cdafaeade3886e5de7edd4b207d4f75ef2fa3019ae01d90f

See more details on using hashes here.

File details

Details for the file vonage_jwt-1.1.3-py3-none-any.whl.

File metadata

  • Download URL: vonage_jwt-1.1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.4

File hashes

Hashes for vonage_jwt-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 97c1edac9580f17b67d8c4b765a80175015dc8a791579d80c6f91183cc54c93a
MD5 09e1b4416ef544505c1a0b84be500c92
BLAKE2b-256 14006450c9c20a798f78467e033f5f6e6d77834f2e6361e08ad0b4999e855c53

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page