# OAuth2Tools
A toolset for the most requirements dealing with OAuth2 and OpenID Connect.
## Installation
You can download it from [pypi.org](https://pypi.org/project/oauth2tools/) 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:
...
Raw data
{
"_id": null,
"home_page": "",
"name": "oauth2tools",
"maintainer": "Andreas R\u00fchl",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "OAuth2,OIDC,OpenID Connect,Tools,Helper",
"author": "Andreas R\u00fchl",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/6a/6a/32b3471e4d72d0c511e025dee204ebec479b7f6048b5b99aa942ea229532/oauth2tools-0.9.0.tar.gz",
"platform": null,
"description": "# OAuth2Tools\n\nA toolset for the most requirements dealing with OAuth2 and OpenID Connect.\n\n## Installation\n\nYou can download it from [pypi.org](https://pypi.org/project/oauth2tools/) or install it with pip\n\n pip install oauth2tools\n\n## Samples\n\n### Building the URL for the authentication endpoint\n\n from oauth2tools import OAuthTools\n\n tools = OAuthTools(\n well_known_url=\"<url>\", \n client_id=\"<cid>\", \n client_secret=\"<secret>\")\n auth_url = tools.authorization_url(redirect_uri=\"<uri>\")\n\n### Using the Browser in a CLI script for authentication\n\n from oauth2tools import OAuth4CLI\n\n o4c = OAuth4CLI(\n well_known_url=\"<url>\", \n client_id=\"<cid>\", \n client_secret=\"<secret>\")\n response = o4c.login()\n access_token = response.get('access_token')\n\n### Validate an received token\n\n from oauth2tools import jwt_helper\n \n try:\n jwt_helper.validate_by_jwks(\n token=\"<jwt>\", \n jwks_url=\"<jwks_url>\",\n claims={\"<claim_name>\": \"expected_value\"})\n except Exception as e:\n ...\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A toolset for the most requirements dealing with OAuth2 and OpenID Connect.",
"version": "0.9.0",
"project_urls": {
"Bug Tracker": "https://github.com/aruehl/oauth2tools/issues",
"GitHub": "https://github.com/aruehl/oauth2tools"
},
"split_keywords": [
"oauth2",
"oidc",
"openid connect",
"tools",
"helper"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "93e9aca12b95f1e02d119d6f89017139e3506e521e5c858880745963166c8ac6",
"md5": "65ae907a6e81409cfedf46bb7e62f2f2",
"sha256": "9205818e6c4600b7b5537b01f06636048924c0aa47924902b1d9e654786a8947"
},
"downloads": -1,
"filename": "oauth2tools-0.9.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "65ae907a6e81409cfedf46bb7e62f2f2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 8736,
"upload_time": "2023-10-08T08:51:35",
"upload_time_iso_8601": "2023-10-08T08:51:35.983483Z",
"url": "https://files.pythonhosted.org/packages/93/e9/aca12b95f1e02d119d6f89017139e3506e521e5c858880745963166c8ac6/oauth2tools-0.9.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6a6a32b3471e4d72d0c511e025dee204ebec479b7f6048b5b99aa942ea229532",
"md5": "75fcc2d19f8fff9d2d6d8ea063fab1a8",
"sha256": "42987726bac689b53efc7a5ca44029f2f2057fadcee316f7a1bcb31233113ff4"
},
"downloads": -1,
"filename": "oauth2tools-0.9.0.tar.gz",
"has_sig": false,
"md5_digest": "75fcc2d19f8fff9d2d6d8ea063fab1a8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 7743,
"upload_time": "2023-10-08T08:51:37",
"upload_time_iso_8601": "2023-10-08T08:51:37.432052Z",
"url": "https://files.pythonhosted.org/packages/6a/6a/32b3471e4d72d0c511e025dee204ebec479b7f6048b5b99aa942ea229532/oauth2tools-0.9.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-08 08:51:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "aruehl",
"github_project": "oauth2tools",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "cryptography",
"specs": []
},
{
"name": "flask",
"specs": []
},
{
"name": "PyJWT",
"specs": []
},
{
"name": "requests",
"specs": []
},
{
"name": "toml",
"specs": []
},
{
"name": "werkzeug",
"specs": []
}
],
"lcname": "oauth2tools"
}