Socket
Socket
Sign inDemoInstall

oauth2tools

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oauth2tools

A toolset for the most requirements dealing with OAuth2 and OpenID Connect.


Maintainers
1

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:
    ...

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc