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 hashes)
Built Distribution
Close
Hashes for oauth2tools-0.9.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e89a56ef5262b3e5ef43be379e874a27ff9c02f0fed1f7a1f90359fe2aa93a91 |
|
MD5 | 864620d68204209a24f405b68b5d333f |
|
BLAKE2b-256 | b3e3a0aef76b2c2b02066c48458ca5c4a29b659314f2f0d45fe6755be2cd12c5 |