Overview
Thesso client provides enterprise-grade single sign-on for your developer organization. It supports multiple identity provider connections (OIDC, SAML 2.0, and LDAP), domain-based enforcement, JIT (just-in-time) provisioning, and session management. Compatible with Okta, Azure AD, Google Workspace, Auth0, OneLogin, PingFederate, OpenLDAP, FreeIPA, and any SAML 2.0, OIDC, or LDAP-compliant provider.
Access the SSO client via client.sso.
Enterprise SSO Connections
Create Connection
Create a new SSO identity provider connection. You can create multiple connections for different domains or providers.SAML example
CreateSsoConnectionParams
| Field | Type | Required | Description |
|---|---|---|---|
name | str | Yes | A human-readable name for this connection. |
protocol | str | Yes | "oidc", "saml", or "ldap". |
issuer_url | str | OIDC only | The OIDC issuer URL. |
client_id | str | OIDC only | OAuth 2.0 client ID from your IdP. |
client_secret | str | OIDC only | OAuth 2.0 client secret from your IdP. |
metadata_url | str | SAML only | The SAML metadata URL. |
assertion_consumer_service_url | str | SAML only | The SAML ACS URL. |
entity_id | str | SAML only | The SAML service provider entity ID. |
domains | list[str] | No | Email domains to associate with this connection. |
jit_provisioning | bool | No | Enable just-in-time user provisioning. Defaults to False. |
default_role | str | No | Default role for JIT-provisioned users. |
attribute_mapping | dict[str, str] | No | Custom attribute mapping for SAML assertions. |
SsoConnection
| Field | Type | Description |
|---|---|---|
id | str | Unique connection identifier. |
name | str | The connection display name. |
protocol | str | "oidc", "saml", or "ldap". |
status | str | "active", "inactive", or "error". |
domains | list[str] | Associated email domains. |
jit_provisioning | bool | Whether JIT provisioning is enabled. |
created_at | str | ISO 8601 creation timestamp. |
updated_at | str | ISO 8601 last-updated timestamp. |
Note: The client_secret is never returned in responses. It is stored securely on the server.
List Connections
List all SSO connections for your organization.SsoConnectionList
| Field | Type | Description |
|---|---|---|
connections | list[SsoConnection] | Array of SSO connection objects. |
Get Connection
Retrieve a single SSO connection by ID.Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
connection_id | str | Yes | The connection ID to retrieve. |
Update Connection
Update an existing SSO connection.UpdateSsoConnectionParams
| Field | Type | Required | Description |
|---|---|---|---|
name | str | No | Updated display name. |
domains | list[str] | No | Updated list of associated email domains. |
jit_provisioning | bool | No | Enable or disable JIT provisioning. |
default_role | str | No | Updated default role for JIT-provisioned users. |
attribute_mapping | dict[str, str] | No | Updated SAML attribute mapping. |
Delete Connection
Delete an SSO connection. Users associated with this connection will no longer be able to log in via SSO.Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
connection_id | str | Yes | The connection ID to delete. |
Warning: Deleting a connection immediately disables SSO login for all users routed through it. Ensure you have an alternative authentication method configured before removing a connection.
Test Connection
Test an SSO connection to verify that the IdP configuration is correct and reachable.Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
connection_id | str | Yes | The connection ID to test. |
SsoTestResult
| Field | Type | Description |
|---|---|---|
success | bool | Whether the connection test passed. |
message | str | Human-readable result message. |
response_time | int | IdP response time in milliseconds. |
Enforcement
Set Enforcement
Enforce SSO login for your organization. When enabled, all members must authenticate through an SSO connection.SsoEnforcementParams
| Field | Type | Required | Description |
|---|---|---|---|
enforced | bool | Yes | Whether SSO login is enforced for all members. |
exempt_roles | list[str] | No | Roles exempt from SSO enforcement. |
SsoEnforcement
| Field | Type | Description |
|---|---|---|
enforced | bool | Whether SSO enforcement is active. |
exempt_roles | list[str] | Roles exempt from the enforcement policy. |
Session Management
List Sessions
List active SSO sessions for your organization.SsoSessionList
| Field | Type | Description |
|---|---|---|
sessions | list[SsoSession] | Array of active SSO session objects. |
SsoSession
| Field | Type | Description |
|---|---|---|
id | str | Session identifier. |
email | str | The user’s email address. |
connection_id | str | The SSO connection used for this session. |
connection_name | str | Display name of the SSO connection. |
created_at | str | ISO 8601 session creation timestamp. |
expires_at | str | ISO 8601 session expiration timestamp. |
Revoke Session
Revoke an active SSO session, forcing the user to re-authenticate.Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
session_id | str | Yes | The session ID to revoke. |
Enterprise Login Flow
Get Login URL (enterprise)
Get the SSO authorization URL for a user based on their email domain. The domain is matched against configured connections to route the user to the correct IdP.SsoLoginParams
| Field | Type | Required | Description |
|---|---|---|---|
domain | str | Yes | Email domain to match against SSO connections. |
redirect_uri | str | No | Override the redirect URI for this login request. |
SsoLoginResponse
| Field | Type | Description |
|---|---|---|
authorize_url | str | The full authorization URL. Redirect the user here. |
connection_id | str | The matched SSO connection ID. |
protocol | str | The protocol of the matched connection. |
Handle OIDC Callback
Handle the callback from an OIDC identity provider. Exchanges the authorization code for user information and provisions the user if JIT is enabled.SsoOidcCallbackParams
| Field | Type | Required | Description |
|---|---|---|---|
code | str | Yes | The authorization code from the OIDC callback. |
state | str | Yes | The state parameter for CSRF protection. |
SsoCallbackResponse
| Field | Type | Description |
|---|---|---|
email | str | None | The user’s email address from the IdP. |
name | str | None | The user’s display name from the IdP. |
sub | str | None | The user’s subject identifier from the IdP. |
developer_id | str | The Grantex developer ID. |
connection_id | str | The SSO connection that handled this authentication. |
provisioned | bool | Whether the user was JIT-provisioned during this login. |
Handle SAML Callback
Handle the callback from a SAML 2.0 identity provider. Validates the SAML assertion and provisions the user if JIT is enabled.SsoSamlCallbackParams
| Field | Type | Required | Description |
|---|---|---|---|
saml_response | str | Yes | The base64-encoded SAML response from the IdP. |
relay_state | str | No | The RelayState parameter from the SAML callback. |
Response
Returns the sameSsoCallbackResponse as handle_oidc_callback().
Handle LDAP Callback
Authenticate a user via LDAP bind. Unlike OIDC and SAML which use browser redirects, LDAP authentication submits credentials directly. Grantex binds to the LDAP directory, verifies the user’s password, reads their attributes and group memberships, maps groups to scopes, and provisions the user if JIT is enabled.SsoLdapCallbackParams
| Field | Type | Required | Description |
|---|---|---|---|
username | str | Yes | The user’s LDAP username (e.g. uid, sAMAccountName, or full DN). |
password | str | Yes | The user’s LDAP password for bind authentication. |
connection_id | str | Yes | The SSO connection ID for the LDAP directory. |
Response
Returns the sameSsoCallbackResponse as handle_oidc_callback().
Note: LDAP credentials are never stored by Grantex. They are used only for the bind operation and discarded immediately after authentication.
Full Enterprise SSO Flow Example
Legacy Single-Config Methods
Note: The following methods manage a single OIDC configuration per organization. They are retained for backward compatibility. For new integrations, use the enterprise connection methods above which support multiple IdPs, SAML, and domain-based routing.
Create Config
Create or update the OIDC SSO configuration for your developer organization:CreateSsoConfigParams
| Field | Type | Required | Description |
|---|---|---|---|
issuer_url | str | Yes | The OIDC issuer URL (e.g. https://accounts.google.com). |
client_id | str | Yes | The OIDC client ID from your IdP. |
client_secret | str | Yes | The OIDC client secret from your IdP. |
redirect_uri | str | Yes | The redirect URI registered with your IdP. |
Get Config
Retrieve the current SSO configuration. The client secret is not included in the response:SsoConfig
| Field | Type | Description |
|---|---|---|
issuer_url | str | The OIDC issuer URL. |
client_id | str | The OIDC client ID. |
redirect_uri | str | The registered redirect URI. |
created_at | str | ISO 8601 creation timestamp. |
updated_at | str | ISO 8601 last-updated timestamp. |
Delete Config
Remove the SSO configuration:Get Login URL (legacy)
Generate the OIDC authorization URL to redirect a user to for SSO login:Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
org | str | Yes | The organization identifier for SSO lookup. |
SsoLoginResponse (legacy)
| Field | Type | Description |
|---|---|---|
authorize_url | str | The OIDC authorization URL to redirect the user to. |
Handle Callback
Exchange the OIDC authorization code for user information after the IdP redirects back to your application:Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
code | str | Yes | The authorization code from the OIDC callback. |
state | str | Yes | The state parameter for CSRF verification. |
SsoCallbackResponse (legacy)
| Field | Type | Description |
|---|---|---|
developer_id | str | The Grantex developer ID for the authenticated user. |
email | str | None | The user’s email address (if provided by IdP). |
name | str | None | The user’s display name (if provided by IdP). |
sub | str | None | The OIDC subject identifier. |