Skip to main content

No project description provided

Project description

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.

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

ssoready-1.1.0.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

ssoready-1.1.0-py3-none-any.whl (47.7 kB view details)

Uploaded Python 3

File details

Details for the file ssoready-1.1.0.tar.gz.

File metadata

  • Download URL: ssoready-1.1.0.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.8.18 Linux/5.15.0-1070-azure

File hashes

Hashes for ssoready-1.1.0.tar.gz
Algorithm Hash digest
SHA256 5f5f049a9b5a32b453498b33023e48bc753051ecefefa68b6a504c751d4ac4e3
MD5 1e00327605c114b4ac18abd8d13be91d
BLAKE2b-256 72c8d0bc39f1c2adcd4f32137b6e339feffc274724dcacb0752efece19d25796

See more details on using hashes here.

File details

Details for the file ssoready-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: ssoready-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 47.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.8.18 Linux/5.15.0-1070-azure

File hashes

Hashes for ssoready-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d5a2f8e9a8753f35475d8afd5866689294eee7268e2f36fa250ef78d30442f26
MD5 53940b5b25edce80cb06b6199072dbfe
BLAKE2b-256 512882c79612f05f89ee00fee6a1a91a2b2e0031380b2d9bbeac97bf02e06117

See more details on using hashes here.

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