Decode and verify Amazon Cognito JWT tokens
Project description
Decode and verify Amazon Cognito JWT tokens
Note: tested on Python >= 3.6, compatible with PEP-492 (async/await coroutines syntax)
Installation
Package works in two modes: synchronous (requests as http-client) and asynchronous (aiohttp as http-client). In order to avoid installing unnecessary dependencies I separated installation flow into two modes:
- Async mode -
pip install cognitojwt[async] - Sync mode -
pip install cognitojwt[sync]
Usage
import cognitojwt
id_token = '<YOUR_TOKEN_HERE>'
REGION = '**-****-*'
USERPOOL_ID = 'eu-west-1_*******'
APP_CLIENT_ID = '1p3*********'
# Sync mode
verified_claims = cognitojwt.decode(
id_token,
REGION,
USERPOOL_ID,
APP_CLIENT_ID,
testmode=True # disable token expiration checking for testing purposes
)
# Async mode
verified_claims = await cognitojwt.decode_async(
id_token,
REGION,
USERPOOL_ID,
APP_CLIENT_ID,
testmode=True # disable token expiration checking for testing purposes
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cognitojwt-1.0.3.tar.gz
(4.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cognitojwt-1.0.3.tar.gz.
File metadata
- Download URL: cognitojwt-1.0.3.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d599446444bcfb5876677c9ba471782c7179ae7f348c4b09e858f0b17b2c9bdb
|
|
| MD5 |
f1e5fae57540df651c55cd2428ba886e
|
|
| BLAKE2b-256 |
aade46fca6c1ac72f77afd47f591ca4d81a08de161f59b7d41149f8d1c367ebb
|
File details
Details for the file cognitojwt-1.0.3-py3-none-any.whl.
File metadata
- Download URL: cognitojwt-1.0.3-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
567ad5a4dc6a47d2b13018c86bb1fdd62af930a034d109b98a08f22430a22d15
|
|
| MD5 |
7902b69065d054ca2c35395433037567
|
|
| BLAKE2b-256 |
0a108295df8068fc844deb7e3fc8d6ce82287b2af4c4dbaf29cd307dc066151f
|