Skip to main content

JSON Web Token library for Python 3.

Project description

https://travis-ci.org/GehirnInc/python-jwt.svg?branch=master https://coveralls.io/repos/GehirnInc/python-jwt/badge.png?branch=master https://badge.fury.io/py/jwt.svg?dummy

python-jwt

python-jwt is a JSON Web Token (JWT) implementation in Python developed by Gehirn Inc.

Examples

import json

from jwt import (
    JWT,
    jwk_from_dict,
    jwk_from_pem,
)

message = {
    'iss': 'https://example.com/',
    'sub': 'yosida95',
    'iat': 1485969205,
    'exp': 1485972805,
}

with open('rsa_private_key.pem', 'rb') as fh:
    signing_key = jwk_from_pem(fh.read())

jwt = JWT()
compact_jws = jwt.encode(message, signing_key, 'RS256')

with open('rsa_public_key.json', 'r') as fh:
    verifying_key = jwk_from_dict(json.load(fh))

message_received = jwt.decode(compact_jws, verifying_key)

assert message == message_received

Installation

You can install python-jwt with pip.

$ pip install jwt

Implementation Details

Supported Algorithms

  • Unsecured

    • none

  • Symmetric

    • HS256

    • HS384

    • HS512

  • Asymmetric

    • RS256

    • RS384

    • RS512

Supported Python Versions

  • Python 3.4

  • Python 3.5

  • Python 3.6

License

python-jwt is licensed under the Apache License version 2. See ./LICENSE.rst.

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

jwt-0.5.1.tar.gz (6.8 kB view details)

Uploaded Source

Built Distributions

jwt-0.5.1-py36-none-any.whl (12.7 kB view details)

Uploaded Python 3.6

jwt-0.5.1-py35-none-any.whl (12.7 kB view details)

Uploaded Python 3.5

jwt-0.5.1-py34-none-any.whl (12.7 kB view details)

Uploaded Python 3.4

File details

Details for the file jwt-0.5.1.tar.gz.

File metadata

  • Download URL: jwt-0.5.1.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for jwt-0.5.1.tar.gz
Algorithm Hash digest
SHA256 dd21f934f03f1b07786eb78374d2e81d188a24af3f9ac143d7d9c80ee276823f
MD5 bf71f935a121aa6b9f4c8843e47b0794
BLAKE2b-256 b95c1d04b158de3e0f3a0ff1d80b7f3538d686c1555cee2b6f18aa0dd9a57484

See more details on using hashes here.

File details

Details for the file jwt-0.5.1-py36-none-any.whl.

File metadata

File hashes

Hashes for jwt-0.5.1-py36-none-any.whl
Algorithm Hash digest
SHA256 1ded8240c1714c9554e71238054176b786e65f41b9388dfdecbc6f62118af04b
MD5 1fc8f6a235d108111b824dfc407fc664
BLAKE2b-256 a9959c8550e9e9ee4a72d08048cc555318d9c71922736e706dd6c7302b462531

See more details on using hashes here.

File details

Details for the file jwt-0.5.1-py35-none-any.whl.

File metadata

File hashes

Hashes for jwt-0.5.1-py35-none-any.whl
Algorithm Hash digest
SHA256 0f7ed202d92d864f12cfd89ef0090625a990e088f85875320353e8a829fedbdb
MD5 3fa02798cfec0caa25ecccd72b2b158f
BLAKE2b-256 0045254657dcdc4447d682495640b26e4ab956f8d4dd1e59b4186dc7077bf83d

See more details on using hashes here.

File details

Details for the file jwt-0.5.1-py34-none-any.whl.

File metadata

File hashes

Hashes for jwt-0.5.1-py34-none-any.whl
Algorithm Hash digest
SHA256 b56bab108b5121847cb394f85ace64be4570cef147007a24db801541815703b7
MD5 c8d05eeedef6712f1353161e28c5573e
BLAKE2b-256 be7f1e1e798f4048a914a48df771f98b2edc3bee08333050e9f8fecbaf6d868e

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