Registry / auth-security / frontegg

frontegg

JSON →
library3.0.4pypypiunverified

Frontegg is a web platform for SaaS companies to integrate managed SaaS features like authentication, authorization, and user management. The Python SDK, currently at version 3.0.4, provides tools to validate tokens, manage users, and integrate Frontegg services into Python applications. It's actively maintained with updates released based on feature development and bug fixes.

pip install frontegg
INSTALL
IMPORT
SIG · FRONTEGG
F
frontegg
auth-securitypythonv3.0.4
Install
6.0s avg
Import
Disk
54MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.0.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 53.9MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 6.0s · import 0.000s · 56MB
54MB installed
● package 54MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

FronteggContext
from frontegg.frontegg_exceptions import FronteggContext
from frontegg import FronteggContext

This quickstart demonstrates how to configure and initialize the Frontegg Python SDK. It sets global configuration parameters using `FronteggConfig` class attributes and then creates an instance of `FronteggContext`, which uses these settings. While actual token validation or service calls require a valid JWT, this example ensures the basic setup is correct and environment variables are honored.

import os from frontegg.frontegg import FronteggContext from frontegg.common.frontegg_config import FronteggConfig # 1. Configure Frontegg global settings # Get your Client ID and API Key from the Frontegg Portal. # Using environment variables is recommended for production. FronteggConfig.client_id = os.environ.get('FRONTEGG_CLIENT_ID', 'FRONTEGG_CLIENT_ID_NOT_SET') FronteggConfig.api_key = os.environ.get('FRONTEGG_API_KEY', 'FRONTEGG_API_KEY_NOT_SET') FronteggConfig.base_url = os.environ.get('FRONTEGG_BASE_URL', 'https://api.frontegg.com') FronteggConfig.middleware_access_strategy = 'token' # or 'cookie' depending on your setup # 2. Initialize the FronteggContext (it uses the globally configured settings) frontegg_context = FronteggContext() # 3. Verify configuration (for demonstration purposes) print("Frontegg SDK initialized.") print(f"Configured Client ID: {FronteggConfig.client_id}") print(f"Configured Base URL: {FronteggConfig.base_url}") # In a real application, you would typically use `frontegg_context.token_service.validate_jwt()` # or decorators like `@with_authentication` in web frameworks to protect routes. # Example (requires a valid JWT token, which is not provided in this quickstart): # try: # # For actual token validation, you'd need a real token, e.g., from an Authorization header # # user_info = frontegg_context.token_service.validate_jwt("YOUR_JWT_TOKEN") # # print(f"Token validated for user: {user_info.get('sub')}") # except Exception as e: # # print(f"Token validation failed: {e}") # pass # Suppress error for runnable quickstart without a token
Debug
Known issues
breakingMajor breaking changes were introduced in version 3.0.0. The configuration flow was completely revamped, core services were consolidated into `FronteggContext`, and framework-specific `Frontegg` classes (e.g., `frontegg.fastapi.Frontegg`) were removed. Additionally, the `frontegg.sanity_middleware` module was removed.
fix
Review the official migration guide for v3.0.0. Update imports to use `from frontegg.frontegg import FronteggContext` and configure settings via `FronteggConfig` class attributes. Replace `sanity_middleware` usage with `FronteggConfig.middleware_access_strategy`.
affects: >=3.0.0
gotchaFronteggConfig uses class attributes for its settings, making it a global configuration. This means you cannot easily manage multiple, distinct Frontegg configurations simultaneously within a single Python process (e.g., for different tenants requiring distinct API keys or base URLs).
fix
Be aware of the global nature of `FronteggConfig`. For multi-tenant scenarios requiring isolated configurations, consider running separate processes or carefully managing configuration changes, though dynamically changing global settings per request is generally not recommended.
affects: All versions
gotchaDirect usage of Frontegg SDK methods (e.g., for token validation) without proper integration into an asynchronous web framework (like FastAPI) might lead to blocking I/O if not correctly awaited in an `async` context. The SDK is largely designed with async operations in mind.
fix
When using Frontegg SDK outside of framework decorators (`@with_authentication`), ensure that any potentially blocking network calls are either `await`ed in an `async` function or handled in a separate thread if your application is synchronous.
affects: All versions
Upgrade
Version history
3.0.4latest on PyPI · released Nov 11, 2024
Audit
Dependencies
requestsrequiredUsed for making HTTP requests to Frontegg APIs.
Agent activity
33 hits · last 30 days
node
30
Resources
frontegg — pip install frontegg · libregistry