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.4.tar.gz
(7.5 kB
view hashes)
Built Distribution
Close
Hashes for oauth2tools-0.8.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 499e6a673bc9a278d212e27e46db48c7775c20bcf43dab5a8e86982406af616c |
|
MD5 | 46209a28f0edebc169193e29e828ecee |
|
BLAKE2b-256 | 6edcf5eeab3a5e6f5126eb2adee3974cba9b206c757a668256aaa61b8f927c82 |