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.
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.8.5.tar.gz
(7.5 kB
view hashes)
Built Distribution
Close
Hashes for oauth2tools-0.8.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84ac90c813a43bd03c66b0392286eea141d38d447cd22b7d034b69b1ae1c213a |
|
MD5 | ed7f24702a5bec87124724d350e54e02 |
|
BLAKE2b-256 | 8b074a1312fc0f6111c53ed4194cf62c03beb1c168e28be0a0af1103ede6631a |