Skip to main content

SSOReady-Python

ssoready is a Python SDK for the SSOReady API.

SSOReady is a set of open-source dev tools for implementing Enterprise SSO. You can use SSOReady to add SAML support to your product this afternoon, for free, forever. You can think of us as an open source alternative to products like Auth0 or WorkOS.

This library includes type definitions for all request and response fields, and offers both synchronous and asynchronous clients powered by httpx.

Installation

Add this dependency to your project's build file:

pip install ssoready
# or
poetry add ssoready

Usage

For full documentation, check out https://ssoready.com/docs.

At a super high level, all it takes to add SAML to your product is to:

  1. Sign up on app.ssoready.com for free
  2. From your login page, call get_saml_redirect_url when you want a user to sign in with SAML
  3. Your user gets redirected back to a callback page you choose, e.g. your-app.com/ssoready-callback?saml_access_code=.... You call redeem_saml_access_code with the saml_access_code and log them in.

Import and construct a SSOReady client like this:

from ssoready.client import SSOReady

client = SSOReady() # loads your API key from the env var SSOREADY_API_KEY
# or
client = SSOReady(api_key="ssoready_sk_...")

Calling the get_saml_redirect_url endpoint looks like this:

# this is how you implement a "Sign in with SSO" button
redirect_url = client.get_saml_redirect_url(
    # the ID of the organization/workspace/team (whatever you call it)
    # you want to log the user into
    organization_external_id="..."
).redirect_url

# redirect the user to `redirect_url`...

And using redeem_saml_access_code looks like this:

# this goes in your handler for POST /ssoready-callback
redeem_result = client.saml.redeem_saml_access_code(saml_access_code="saml_access_code_...")

email = redeem_result.email
organization_external_id = redeem_result.organization_external_id

# log the user in as `email` inside `organizationExternalId`...

Check out the quickstart for the details spelled out more concretely. The whole point of SSOReady is to make enterprise SSO super obvious and easy.

Async Client

You an also use asyncio with this SDK. Do so by using AsyncSSOReady instead of SSOReady.

from ssoready.client import AsyncSSOReady

client = AsyncSSOReady()

async def main() -> None:
    await client.saml.get_redirect_url(organization_external_id="...")
    
asyncio.run(main())

All methods available on the sync SSOReady client are also available on AsyncSSOReady.

Contributing

Issues and PRs are more than welcome. Be advised that this library is largely autogenerated from ssoready/fern-config. Most code changes ultimately need to be made there, not on this repo.

Metadata

Release files for ssoready 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ssoready 1.1.0
File Size Uploaded
ssoready-1.1.0.tar.gz 19.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ssoready 1.1.0
File Interpreter ABI Platform
ssoready-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 67.1 kB

Release files / ssoready-1.1.0.tar.gz

Download URL ssoready-1.1.0.tar.gz
Size 19.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5f5f049a9b5a32b453498b33023e48bc753051ecefefa68b6a504c751d4ac4e3
BLAKE2b-256 checksum
How to use checksums
72c8d0bc39f1c2adcd4f32137b6e339feffc274724dcacb0752efece19d25796
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.8.18 Linux/5.15.0-1070-azure

Release files / ssoready-1.1.0-py3-none-any.whl

Download URL ssoready-1.1.0-py3-none-any.whl
Size 47.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d5a2f8e9a8753f35475d8afd5866689294eee7268e2f36fa250ef78d30442f26
BLAKE2b-256 checksum
How to use checksums
512882c79612f05f89ee00fee6a1a91a2b2e0031380b2d9bbeac97bf02e06117
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.8.18 Linux/5.15.0-1070-azure

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page