A toolset for the most requirements dealing with OAuth2 and OpenID Connect.
Project description
OAuth2Tools
A toolset for the most requirements dealing with OAuth2 and OpenID Connect.
Installation
You can download it from pypi.org or install it with pip
pip install oauth2tools
Samples
Building the URL for the authentication endpoint
from oauth2tools import OAuthTools
tools = OAuthTools(
well_known_url="<url>",
client_id="<cid>",
client_secret="<secret>")
auth_url = tools.authorization_url(redirect_uri="<uri>")
Using the Browser in a CLI script for authentication
from oauth2tools import OAuth4CLI
o4c = OAuth4CLI(
well_known_url="<url>",
client_id="<cid>",
client_secret="<secret>")
response = o4c.login()
access_token = response.get('access_token')
Validate an received token
from oauth2tools import jwt_helper
try:
jwt_helper.validate_by_jwks(
token="<jwt>",
jwks_url="<jwks_url>",
claims={"<claim_name>": "expected_value"})
except Exception as e:
...
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
oauth2tools-0.9.1.tar.gz
(7.9 kB
view details)
Built Distribution
File details
Details for the file oauth2tools-0.9.1.tar.gz
.
File metadata
- Download URL: oauth2tools-0.9.1.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3525675decae544b360b0f5f0254ac16ec8047f67d834a0237e6944013b9763 |
|
MD5 | 972f8408a55e5ffa627b481a0afa9153 |
|
BLAKE2b-256 | 2d7723089f9a176c71268ab1cc6843adcfcba1e067d7b12aa434faf811e3d885 |
File details
Details for the file oauth2tools-0.9.1-py3-none-any.whl
.
File metadata
- Download URL: oauth2tools-0.9.1-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e89a56ef5262b3e5ef43be379e874a27ff9c02f0fed1f7a1f90359fe2aa93a91 |
|
MD5 | 864620d68204209a24f405b68b5d333f |
|
BLAKE2b-256 | b3e3a0aef76b2c2b02066c48458ca5c4a29b659314f2f0d45fe6755be2cd12c5 |