Simple JWT
Why?
I created this package because I found that I often needed to see the cliams of a JWT token and wether it was expired or not. I didn't need to verify it the signatures. I wanted a package to check if the token was expired, so I could refresh my token or take other actions based off that. Most other packages seemed to require verified signatures or would throw errors if a key was not provided. Just needed a simple package to get the cliams info and if the token was expired. Simple JWT.
Table of Contents
Installation
pip install simple-jwt-decode
Usage
Decode
from simple_jwt import jwt
jwt.decode(token)
Should return at dict that looks similar to the following:
{'headers': {'alg': 'HS512'}, 'claims': {'exp': 1681337256, 'iat': 1681333656, 'sid': '15307164276', 'aid': '8652598085', 'cid': '50430702', 'type': 'r'}, 'signature': 'jmFoOydgYnL8AqmgnLSFU2l_E6q3pnPHh7ss-g7xKO7tLD_JY8vZR3O-cthNInFzi9G2M3t2boRzMTatlbsZ7Q'}
Expired
from simple_jwt import jwt
expired = jwt.is_expired(token)
if (expired):
print('Your JWT token is expired! Oh no! Better get a new one')
else:
print('Your JWT token is not expired; No need to refesh at the moment')
CLI Usage
You can also use the command-line interface to decode JWT tokens:
jwt <token>
This will display the decoded token headers, claims, and signature, as well as whether the token is expired.
Options:
--check-expiryor-e: Only check if the token is expired--rawor-r: Print raw decoded data without formatting
Example:
jwt <token>
License
simple-jwt is distributed under the terms of the MIT license.
Metadata
Release files for simple-jwt-decode 0.10.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| simple_jwt_decode-0.10.0.tar.gz | 7.1 kB | Without provenance | Details for simple_jwt_decode-0.10.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| simple_jwt_decode-0.10.0-py3-none-any.whl | Python 3 | none | any | Details for simple_jwt_decode-0.10.0-py3-none-any.whl |
Total release size: 12.8 kB
Release files / simple_jwt_decode-0.10.0.tar.gz
| Download URL | simple_jwt_decode-0.10.0.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f3ee891c67e51e27e0ac9f7efa2f2247cf87ab725d0223f727fd63fc029a874c
|
|
BLAKE2b-256 checksum How to use checksums |
0bafcaa3ae8bb961c47fd388bf02ace410e230ba39b008f992acb827a1a82cc5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Release files / simple_jwt_decode-0.10.0-py3-none-any.whl
| Download URL | simple_jwt_decode-0.10.0-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dfd144499881db52ed7636afc156bf17fb4b8fab33ed6220ad4bf86723fe9a2c
|
|
BLAKE2b-256 checksum How to use checksums |
4c6db1d157ffef77c2df86f8836002403eee6daa6886c6b7beee08201b3d2cef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Security for simple-jwt-decode 0.10.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.