Skip to main content

No project description provided

Project description

sophi-app-internal Python Package

Overview

sophi-app-internal is a Python package designed to facilitate secure and authenticated HTTP request handling, particularly in environments where JWT (JSON Web Token) authentication is used. The package includes utilities for validating JWTs, fetching public keys, and constructing HTTP request objects with robust header and parameter management.

Features

JWT validation and verification using Auth0. Secure fetching of JSON Web Key Sets (JWKS). Construction and management of HTTP request objects with headers, parameters, and body handling. Installation To install the sophi-app-internal package, use the following command:

pip install sophi-app-internal

Usage

Setting Up Variables

Before using the package, ensure you have set up the necessary variables:

  • AUTH0_DOMAIN: Your Auth0 domain, e.g. <tenant>.us.auth0.com.
  • AUDIENCE: The expected token audience. You can set these variables in your environment:
auth0_domain = "app-dev.us.auth0.com"
audience = [
    "https://api.example.com/",
    "https://website.us.auth0.com/userinfo"
  ]

Example Code

Validating JWTs Here's an example of how to validate a JWT using the token_validator function.

from sophi_app_internal import token_validator

try:
    claims = token_validator(token, audience, auth0_domain)
    print(claims)
except Exception as e:
    print(e)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sophi_app_internal-0.0.2.tar.gz (2.7 kB view hashes)

Uploaded Source

Built Distribution

sophi_app_internal-0.0.2-py3-none-any.whl (3.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page