Okta OAuth 2.0 / OAuth 2.1 / OIDC 1.0 identity provider implementations for Swarmauri
Project description
Swarmauri Auth IDP Okta
Okta OAuth 2.0 / OAuth 2.1 / OIDC 1.0 identity providers packaged for Swarmauri deployments.
Features
- PKCE-enabled Authorization Code flows that integrate with Okta authorization servers.
- Machine-to-machine app clients for Okta OAuth 2.0, OAuth 2.1 (private key JWT), and OIDC 1.0.
- Discovery-driven OAuth 2.1/OIDC login that verifies ID tokens using Okta JWKS.
- UserInfo enrichment for deployments that require full user profile hydration.
- Retry-aware HTTP integration tuned for Okta endpoints.
- ComponentBase-compatible models registered under
swarmauri.auth_idpentry points.
Installation
pip
pip install swarmauri_auth_idp_okta
uv (project)
uv add swarmauri_auth_idp_okta
uv (environment)
uv pip install swarmauri_auth_idp_okta
Usage
import asyncio
from pydantic import SecretBytes, SecretStr
from swarmauri_auth_idp_okta import OktaOAuth20Login
login = OktaOAuth20Login(
issuer="https://example.okta.com/oauth2/default",
client_id="okta-client-id",
client_secret=SecretStr("okta-client-secret"),
redirect_uri="https://app.example.com/callback",
state_secret=SecretBytes(b"replace-with-random-bytes"),
)
async def run_flow() -> None:
auth = await login.auth_url()
print(auth["url"])
# Redirect the browser to `auth["url"]`, then capture the callback `code` and `state`.
# Later, call `login.exchange_and_identity(code, state)` inside your callback handler.
asyncio.run(run_flow())
Workflow Summary
- Call
auth_url()and redirect the browser to the returned URL. - Persist the
stateand verify it during the callback handler. - Exchange the authorization code through
exchange_and_identity()to obtain tokens and profile metadata.
Server-to-server client credentials
import asyncio
from pydantic import SecretStr
from swarmauri_auth_idp_okta import OktaOAuth20AppClient
client = OktaOAuth20AppClient(
issuer="https://example.okta.com/oauth2/default",
client_id="machine-client-id",
client_secret=SecretStr("machine-client-secret"),
)
async def fetch_token() -> None:
token = await client.access_token(scope="customScope")
print(token)
asyncio.run(fetch_token())
Use OktaOAuth21AppClient when the integration should authenticate with
private_key_jwt, or OktaOIDC10AppClient to rely on discovery metadata for
tenant-specific token endpoints.
Entry Points
swarmauri.auth_idp:OktaOAuth20AppClientswarmauri.auth_idp:OktaOAuth20Loginswarmauri.auth_idp:OktaOAuth21AppClientswarmauri.auth_idp:OktaOAuth21Loginswarmauri.auth_idp:OktaOIDC10AppClientswarmauri.auth_idp:OktaOIDC10Login
Contributing
To contribute to swarmauri-sdk, review the guidelines for contributing which cover development workflow, testing, and coding standards.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swarmauri_auth_idp_okta-0.2.0.dev5.tar.gz.
File metadata
- Download URL: swarmauri_auth_idp_okta-0.2.0.dev5.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca36b02f84ff56bbab3e74d7f5752a4f681f4790ee0a4f1ec3c77677821a21a9
|
|
| MD5 |
a0d4caa07b03e995ec52215f6eec700d
|
|
| BLAKE2b-256 |
e9e809a4c1944032e48e2fc64e6e1d98f951f89c9f2cfaaf320028fb17a20a56
|
File details
Details for the file swarmauri_auth_idp_okta-0.2.0.dev5-py3-none-any.whl.
File metadata
- Download URL: swarmauri_auth_idp_okta-0.2.0.dev5-py3-none-any.whl
- Upload date:
- Size: 16.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1023c1e5fa76777c88864e1277218e47b71f4a59b30d8c4c1fff6c6d4a38130
|
|
| MD5 |
0681d20b78bee05bed81e1b7727e8dd8
|
|
| BLAKE2b-256 |
ea4f7bdbca910d80a42da288faae73e6ccb25b624c0dc51f5c799bca7ae9c984
|