Enterprise SSO API
Enterprise SSO (Single Sign-On) allows organization members to authenticate using their company’s existing identity provider rather than a username and password. Auris supports both SAML 2.0 and OIDC protocols, backed by Keycloak IdP brokering under the hood.
The SSO flow works as follows:
- An admin creates an SSO connection for an organization, providing their IdP configuration (SAML metadata or OIDC discovery URL).
- The admin adds and verifies one or more email domains (e.g.,
acme-corp.com) via DNS TXT records. - Once the connection is activated, users with a verified domain email are automatically redirected to the IdP when they attempt to log in.
- On first SSO login, Auris performs Just-In-Time (JIT) provisioning — creating the user account, linking it to the organization, and issuing Auris tokens — all transparently.
All admin SSO endpoints require the x-tenant header and a valid Bearer token.
SSO Connections
/api/organizations/[orgId]/sso/connectionsRequires: view:sso_connectionsList all SSO connections configured for an organization. Returns connection metadata, type, status, and associated verified domains.
Query parameters
| Parameter | Type | Description |
|---|---|---|
page | integer | Page number (default: 1) |
limit | integer | Items per page (default: 20) |
Success response
{
"ok": true,
"data": [
{
"id": "sso_abc123",
"type": "saml",
"name": "Acme Corporate IdP",
"status": "ACTIVE",
"keycloakIdpAlias": "acme-saml-abc123",
"domains": ["acme-corp.com", "acme.io"],
"createdAt": "2025-01-20T09:00:00Z",
"updatedAt": "2025-02-01T14:30:00Z"
}
]
}SSO connection statuses:
| Status | Description |
|---|---|
PENDING | Connection created but not yet activated |
ACTIVE | Connection is live — users with verified domain emails are redirected |
DISABLED | Connection was deactivated by an admin |
ERROR | Connection encountered a configuration error during IdP communication |
/api/organizations/[orgId]/sso/connectionsRequires: manage:sso_connectionsCreate a new SSO connection for the organization. Auris registers a corresponding Identity Provider in Keycloak and returns the Service Provider metadata needed to configure the IdP on the customer’s side.
SAML 2.0 Configuration
For SAML-based SSO, provide the Identity Provider’s metadata. You can supply either a metadataUrl (recommended — Auris will fetch and parse it automatically) or provide the individual fields manually.
Request body — SAML with metadata URL
{
"type": "saml",
"name": "Acme Corporate SAML",
"config": {
"metadataUrl": "https://idp.acme-corp.com/federationmetadata/2007-06/federationmetadata.xml"
}
}Request body — SAML with manual configuration
{
"type": "saml",
"name": "Acme Corporate SAML",
"config": {
"entityId": "https://idp.acme-corp.com",
"ssoUrl": "https://idp.acme-corp.com/saml2/sso",
"certificate": "-----BEGIN CERTIFICATE-----\nMIIDpDCCAoygAwIBAgIGAX...\n-----END CERTIFICATE-----"
}
}| Field | Required | Description |
|---|---|---|
metadataUrl | No | URL to the IdP’s SAML metadata XML. If provided, entityId, ssoUrl, and certificate are extracted automatically. |
entityId | Yes* | The IdP’s Entity ID (Issuer). Required if metadataUrl is not provided. |
ssoUrl | Yes* | The IdP’s Single Sign-On Service URL (HTTP-Redirect binding). Required if metadataUrl is not provided. |
certificate | Yes* | The IdP’s X.509 signing certificate in PEM format. Required if metadataUrl is not provided. |
OIDC Configuration
For OIDC-based SSO, provide the discovery URL and the client credentials issued by the IdP.
Request body — OIDC
{
"type": "oidc",
"name": "Acme OIDC Provider",
"config": {
"discoveryUrl": "https://login.acme-corp.com/.well-known/openid-configuration",
"clientId": "auris-sp-client-id",
"clientSecret": "auris-sp-client-secret"
}
}| Field | Required | Description |
|---|---|---|
discoveryUrl | Yes | The IdP’s OIDC Discovery URL. Auris fetches the authorization_endpoint, token_endpoint, and jwks_uri from it. |
clientId | Yes | The Client ID registered at the IdP for Auris as a relying party. |
clientSecret | Yes | The Client Secret for the relying party registration. |
Success response
{
"ok": true,
"data": {
"id": "sso_def456",
"type": "saml",
"name": "Acme Corporate SAML",
"status": "PENDING",
"keycloakIdpAlias": "acme-saml-def456",
"acsUrl": "https://api.altovar.net/api/auth/sso/callback",
"entityId": "https://api.altovar.net",
"createdAt": "2025-02-18T10:00:00Z"
}
}The acsUrl (Assertion Consumer Service URL) and entityId in the response are the Service Provider values that must be configured in the customer’s Identity Provider. For SAML, set the ACS URL as the reply URL and Auris’s entity ID as the audience. For OIDC, register the acsUrl as a redirect URI at the IdP.
Error codes
| Code | HTTP | Description |
|---|---|---|
VALIDATION_ERROR | 400 | Missing required fields or invalid configuration |
METADATA_FETCH_FAILED | 400 | Could not fetch or parse the SAML metadata URL |
DISCOVERY_FETCH_FAILED | 400 | Could not fetch or parse the OIDC discovery document |
SSO_CONNECTION_EXISTS | 409 | An SSO connection of this type already exists for the organization |
/api/organizations/[orgId]/sso/connections/[id]Requires: view:sso_connectionsGet full details for a specific SSO connection, including the configuration (with secrets redacted), SP metadata values, and associated domains.
Success response
{
"ok": true,
"data": {
"id": "sso_abc123",
"type": "saml",
"name": "Acme Corporate SAML",
"status": "ACTIVE",
"keycloakIdpAlias": "acme-saml-abc123",
"config": {
"entityId": "https://idp.acme-corp.com",
"ssoUrl": "https://idp.acme-corp.com/saml2/sso",
"certificate": "-----BEGIN CERTIFICATE-----\nMIIDpD..."
},
"acsUrl": "https://api.altovar.net/api/auth/sso/callback",
"spEntityId": "https://api.altovar.net",
"domains": ["acme-corp.com"],
"createdAt": "2025-01-20T09:00:00Z",
"updatedAt": "2025-02-01T14:30:00Z"
}
}/api/organizations/[orgId]/sso/connections/[id]Requires: manage:sso_connectionsUpdate an SSO connection’s name or configuration. The connection type (saml or oidc)
cannot be changed after creation. Updating the configuration triggers re-sync with the
Keycloak IdP broker.
Request body
{
"name": "Acme Corporate SAML (Updated)",
"config": {
"ssoUrl": "https://new-idp.acme-corp.com/saml2/sso",
"certificate": "-----BEGIN CERTIFICATE-----\nMIIEnD..."
}
}Success response
{
"ok": true,
"data": {
"id": "sso_abc123",
"type": "saml",
"name": "Acme Corporate SAML (Updated)",
"status": "ACTIVE",
"updatedAt": "2025-02-18T11:00:00Z"
}
}/api/organizations/[orgId]/sso/connections/[id]Requires: manage:sso_connectionsDelete an SSO connection. The corresponding Keycloak Identity Provider is removed. Users who previously authenticated via this connection will fall back to password-based login. Their accounts and data are preserved.
Deleting an active SSO connection immediately affects all users who authenticate through it. They will need to reset their password (via the forgot-password flow) if they have never set one, since SSO users are JIT-provisioned without a password.
Success response
{
"ok": true,
"data": { "deleted": true }
}Activate and Deactivate
/api/organizations/[orgId]/sso/connections/[id]/activateRequires: manage:sso_connectionsActivate a PENDING or DISABLED SSO connection. After activation, users logging in with a verified domain email are automatically redirected to the configured Identity Provider. Activation requires at least one verified domain to be associated with the organization.
Request: No body required.
Success response
{
"ok": true,
"data": {
"activated": true,
"status": "ACTIVE"
}
}Error codes
| Code | HTTP | Description |
|---|---|---|
NO_VERIFIED_DOMAINS | 400 | Cannot activate SSO without at least one verified domain |
CONNECTION_NOT_FOUND | 404 | SSO connection does not exist |
/api/organizations/[orgId]/sso/connections/[id]/deactivateRequires: manage:sso_connectionsDeactivate an active SSO connection. Users with domain emails will fall back to standard password authentication. The connection configuration is preserved and can be re-activated later.
Request: No body required.
Success response
{
"ok": true,
"data": {
"deactivated": true,
"status": "DISABLED"
}
}Domain Verification
Domain verification proves that you control an email domain before SSO-based auto-redirect is enabled for that domain. Verification is performed via a DNS record (TXT or CNAME). Once a domain is verified, any user who logs in with an email address on that domain is automatically redirected to the organization’s SSO provider.
/api/organizations/[orgId]/sso/domainsRequires: view:sso_connectionsList all domains associated with an organization’s SSO configuration, including their verification status, method, and token.
Success response
{
"ok": true,
"data": [
{
"id": "dom_abc123",
"domain": "acme-corp.com",
"status": "ACTIVE",
"verificationMethod": "TXT",
"verificationToken": "auris-verify-abc123def456",
"verifiedAt": "2025-01-22T14:00:00Z",
"createdAt": "2025-01-20T10:00:00Z"
},
{
"id": "dom_def456",
"domain": "acme.io",
"status": "PENDING",
"verificationMethod": "CNAME",
"verificationToken": "auris-verify-ghi789jkl012",
"verifiedAt": null,
"createdAt": "2025-02-10T08:00:00Z"
}
]
}Domain verification statuses:
| Status | Description |
|---|---|
PENDING | Domain added, DNS record not yet verified |
VERIFYING | Verification check is in progress |
ACTIVE | Domain verified successfully — SSO auto-redirect is active for this domain |
FAILED | Verification check ran but the expected DNS record was not found |
/api/organizations/[orgId]/sso/domainsRequires: manage:sso_connectionsAdd a domain to the organization and initiate verification. Auris generates a unique verification token that must be added as a DNS record on the domain. The response includes the exact DNS record to create.
Request body
{
"domain": "acme-corp.com"
}Success response
{
"ok": true,
"data": {
"id": "dom_ghi789",
"domain": "acme-corp.com",
"status": "PENDING",
"verificationMethod": "TXT",
"verificationToken": "auris-verify-mno345pqr678",
"dnsRecord": {
"type": "TXT",
"host": "_auris-verify.acme-corp.com",
"value": "auris-verify-mno345pqr678"
}
}
}Add the DNS record shown in dnsRecord at your domain registrar, then call the check endpoint to verify.
Error codes
| Code | HTTP | Description |
|---|---|---|
DOMAIN_TAKEN | 409 | This domain is already registered to another organization |
VALIDATION_ERROR | 400 | Invalid domain format |
DOMAIN_EXISTS | 409 | This domain is already associated with this organization |
Auris supports two DNS verification methods. TXT records (default) require adding a TXT record at _auris-verify.yourdomain.com. CNAME records require pointing a CNAME at verify.your-auris-domain.com. The method is chosen automatically based on the domain configuration, but TXT is preferred as it does not interfere with existing DNS records.
/api/organizations/[orgId]/sso/domains/[id]/checkRequires: manage:sso_connectionsTrigger a live DNS lookup to verify the domain. Auris performs a DNS TXT (or CNAME) query
using dns.promises.resolveTxt() and checks for the verification token. Returns the
updated domain status immediately.
Request: No body required.
Success response — verified
{
"ok": true,
"data": {
"domain": "acme-corp.com",
"status": "ACTIVE",
"verifiedAt": "2025-02-18T15:00:00Z"
}
}Success response — not yet propagated
{
"ok": true,
"data": {
"domain": "acme-corp.com",
"status": "PENDING",
"message": "TXT record not found yet. DNS propagation can take up to 48 hours."
}
}Success response — failed
{
"ok": true,
"data": {
"domain": "acme-corp.com",
"status": "FAILED",
"message": "DNS lookup completed but the verification token was not found in any TXT records."
}
}DNS propagation typically takes a few minutes but can take up to 48 hours in rare cases. You can call the check endpoint repeatedly until the status transitions to ACTIVE. A FAILED status does not permanently block verification — fix the DNS record and call check again.
Public SSO Endpoints
These endpoints are used by the Auris Hosted Login page and SDK to perform the SSO flow. They do not require authentication.
/api/auth/sso/detectDetect whether a user’s email domain has an active Enterprise SSO connection. Use this to build “smart” login forms that automatically redirect enterprise users to their SSO provider instead of showing the password field.
Request body
{
"email": "[email protected]"
}Response — SSO available
{
"ok": true,
"data": {
"ssoAvailable": true,
"provider": "saml",
"loginUrl": "https://api.altovar.net/api/auth/sso/login/acme-saml-abc123"
}
}Response — no SSO
{
"ok": true,
"data": {
"ssoAvailable": false,
"provider": null,
"loginUrl": null
}
}The response is always 200 OK regardless of whether the domain has SSO configured, to prevent information leakage about which organizations use SSO.
/api/auth/sso/login/[alias]Initiate the SSO login flow. Redirects the browser to the configured Identity Provider’s
login page. The alias is the Keycloak IdP alias returned when creating the SSO connection
(the keycloakIdpAlias field).
This endpoint is a browser redirect, not an API call. The typical flow:
- Client detects SSO via
POST /api/auth/sso/detect - Client redirects the browser to the
loginUrlfrom the detection response - Auris redirects to the IdP’s login page
- User authenticates at the IdP
- IdP redirects back to Auris’s callback endpoint
- Auris issues tokens and redirects to the application’s callback URL
Query parameters
| Parameter | Type | Description |
|---|---|---|
redirect_uri | string | Optional. Where to redirect the user after successful SSO authentication. Must be a registered redirect URI for the application. |
/api/auth/sso/callbackSSO callback endpoint. The Identity Provider redirects the user here after successful authentication. Auris validates the SSO assertion (SAML response or OIDC authorization code), performs JIT user provisioning if needed, and issues Auris tokens.
This endpoint is called by the Identity Provider, not by your application directly.
JIT (Just-In-Time) Provisioning
When a user authenticates via SSO for the first time and does not yet have an Auris account, Auris automatically:
- Creates a new user account using attributes from the SSO assertion (email, first name, last name)
- Links the user to the organization that owns the SSO connection
- Assigns the default member role (
MEMBER) - Issues standard Auris access and refresh tokens
On subsequent logins, the existing user record is matched by email and tokens are issued directly.
Redirect on success
After successful authentication, the user is redirected to the application’s registered callback URL with an authorization code:
https://app.yourdomain.com/callback?code=auth_code_xxx&state=original_stateThe authorization code can then be exchanged for tokens using the standard POST /api/auth/token endpoint with grant_type=authorization_code.
Error handling
If the SSO assertion is invalid or the IdP returns an error, the user is redirected to the application callback with error parameters:
https://app.yourdomain.com/callback?error=sso_failed&error_description=SAML+assertion+validation+failed&state=original_state| Error | Description |
|---|---|
sso_failed | The SSO assertion could not be validated |
sso_connection_disabled | The SSO connection has been deactivated |
sso_connection_not_found | The IdP alias does not match any configured SSO connection |
email_mismatch | The email from the SSO assertion does not match a verified domain |
Permissions Reference
| Permission | Description |
|---|---|
view:sso_connections | View SSO connections and domain verification status |
manage:sso_connections | Create, update, delete, activate, and deactivate SSO connections; manage domain verification |
The manage:sso_connections permission implies view:sso_connections. Users with manage:sso_connections can perform all SSO-related operations.
Implementation Notes
Keycloak IdP Brokering: Under the hood, Auris creates and manages Keycloak Identity Provider configurations. Each SSO connection corresponds to a Keycloak IdP with a unique alias. The Keycloak realm for the connection is determined by the keycloakRealm field on the connection record. This is an implementation detail — your application interacts only with the Auris API.
Certificate Rotation: For SAML connections, update the certificate field in the connection config when the IdP rotates its signing certificate. Auris does not automatically detect certificate changes. During rotation, you can temporarily keep both old and new certificates by updating the connection before the old certificate expires.
OIDC Discovery Caching: When using OIDC, Auris caches the discovery document. If the IdP changes its endpoints, update the discoveryUrl or wait for the cache to expire (approximately 1 hour).
Related
- Enterprise SSO Guide — Set up SAML 2.0 and OIDC connections
- Single Sign-On — SSO integration walkthrough
- Enterprise SSO — Configure SSO connections from the Console
- Organizations API — Organization endpoints that SSO connections belong to