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.1.tar.gz
(7.3 kB
view hashes)
Built Distribution
Close
Hashes for oauth2tools-0.8.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7eb3abf57c35b2d8ebca19061f5242057e6416a548e8c24ca0e31a27c5e18a25 |
|
MD5 | 82f2a2f75daaa27a1bba52ffdd42892b |
|
BLAKE2b-256 | f989256292b67d29f889b0fb469fdeeb669100d901fbf9c268c9ba49756a7186 |