RegisterLogin
DocsPricing
RegisterLogin
  • Getting Started
  • Introduction
  • Quick Start
  • SDKs
  • React
  • TypeScript
  • Next.js
  • Express
  • NestJS
  • Python
  • API Reference
  • Support and Resources
  • FAQ
  • Contact Support

AuthSafe

Product

HighlightFeatureIntegrationPricingFAQ

Company

AboutBlogContactSitemap

Developer

DashboardDocumentation

Legal

Terms & ConditionsPrivacyComplianceShippingCancellation

© 2026 AuthSafe. All rights reserved.

We value your privacy

This website uses cookies for anonymous analytics to help us improve your experience. No personal information is stored or shared. You can allow or reject analytics tracking at any time. See our Privacy Policy.

We use cookies for anonymous analytics. No personal info is stored. See our Privacy Policy.

SSOApi

API client for managing SSO connections (SAML, OIDC providers).

Constructor

import { HttpService, SSOApi } from 'authsafe-ts';

const user = await oauthService.getUser();
const httpService = new HttpService(user?.access_token);
const ssoApi = new SSOApi(httpService);

Methods

List SSO Connections

Get all configured SSO connections for the tenant.
await ssoApi.listConnections(): Promise<SSOConnection[]>
Returns:
interface SSOConnection {
  id: string;
  name: string;
  provider: 'saml' | 'google' | 'microsoft' | 'github' | 'custom-oidc';
  enabled: boolean;
  created_at: string;
  metadata?: Record<string, any>;
}
Example:
const connections = await ssoApi.listConnections();
console.log('SSO providers:', connections);

Get SSO Connection

Fetch details of a specific SSO connection.
await ssoApi.getConnection(connectionId: string): Promise<SSOConnection>
Example:
const connection = await ssoApi.getConnection('conn-123');
console.log('Provider:', connection.name, connection.provider);

Create SSO Connection

Configure a new SSO provider.
await ssoApi.createConnection(data: {
  name: string;
  provider: 'saml' | 'google' | 'microsoft' | 'github' | 'custom-oidc';
  config: SSOProviderConfig;
}): Promise<SSOConnection>
SAML Configuration:
interface SAMLConfig {
  entity_id: string;
  sign_in_url: string;
  certificate: string;
  sign_request?: boolean;
  signature_algorithm?: 'sha256' | 'sha512';
}
OIDC Configuration:
interface OIDCConfig {
  client_id: string;
  client_secret: string;
  authorization_endpoint: string;
  token_endpoint: string;
  userinfo_endpoint?: string;
  scope?: string[];
}
Example (SAML):
const connection = await ssoApi.createConnection({
  name: 'Okta SSO',
  provider: 'saml',
  config: {
    entity_id: 'https://dev-123.okta.com',
    sign_in_url: 'https://dev-123.okta.com/app/sso/saml',
    certificate: '-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----',
    sign_request: true,
  },
});
Example (Google):
const connection = await ssoApi.createConnection({
  name: 'Google Workspace',
  provider: 'google',
  config: {
    client_id: 'your-google-client-id',
    client_secret: 'your-google-client-secret',
    hd: 'yourcompany.com', // Restrict to domain
  },
});

Update SSO Connection

Modify an existing SSO connection.
await ssoApi.updateConnection(
  connectionId: string,
  data: Partial<SSOConnection>
): Promise<SSOConnection>
Example:
const updated = await ssoApi.updateConnection('conn-123', {
  enabled: true,
  name: 'Updated SSO Name',
});

Delete SSO Connection

Remove an SSO provider configuration.
await ssoApi.deleteConnection(connectionId: string): Promise<{ success: boolean }>
Example:
await ssoApi.deleteConnection('conn-123');
console.log('SSO connection removed');

Complete Examples

Setup SAML SSO

import { OAuthService, HttpService, SSOApi } from 'authsafe-ts';

// Initialize (requires admin token)
const oauthService = new OAuthService({ clientId, redirectUri });
const user = await oauthService.getUser();
const httpService = new HttpService(user?.access_token);
const ssoApi = new SSOApi(httpService);

// Create SAML connection
const samlConnection = await ssoApi.createConnection({
  name: 'Corporate SAML',
  provider: 'saml',
  config: {
    entity_id: 'https://idp.example.com',
    sign_in_url: 'https://idp.example.com/sso/saml',
    certificate: document.getElementById('cert-input').value,
    sign_request: true,
    signature_algorithm: 'sha256',
  },
});

console.log('SAML SSO configured:', samlConnection.id);

Setup Google Workspace SSO

const googleSSO = await ssoApi.createConnection({
  name: 'Google Workspace',
  provider: 'google',
  config: {
    client_id: process.env.GOOGLE_CLIENT_ID,
    client_secret: process.env.GOOGLE_CLIENT_SECRET,
    hd: 'yourcompany.com', // Domain restriction
    scope: ['openid', 'email', 'profile'],
  },
});

console.log('Google SSO enabled');

List and Manage Connections

// Get all connections
const connections = await ssoApi.listConnections();

// Enable/disable connections
for (const conn of connections) {
  if (conn.provider === 'saml') {
    await ssoApi.updateConnection(conn.id, { enabled: true });
  }
}

// Delete old connections
const oldConnections = connections.filter((c) => !c.enabled);
for (const conn of oldConnections) {
  await ssoApi.deleteConnection(conn.id);
}

Related

  • OAuthService - Authentication flows
  • Type Definitions - SSO types
  • TypeScript SDK Overview