Docs

updateSamlConnection()

Updates a SamlConnection by its ID.

function updateSamlConnection: (samlConnectionId: string, params: UpdateSamlConnectionParams = {}) => Promise<Organization>;
  • Name
    name?
    Type
    string
    Description

    The name to use as a label for this SAML Connection.

  • Name
    provider?
    Type
    'saml_custom' | 'saml_okta' | 'saml_google' | 'saml_microsoft'
    Description

    The IdP provider of the connection.

  • Name
    domain?
    Type
    string
    Description

    The domain of your organization. Sign in flows using an email with this domain will use this SAML Connection. For example: 'clerk.dev'

  • Name
    idpEntityId?
    Type
    string
    Description

    The Entity ID as provided by the IdP.

  • Name
    idpSsoUrl?
    Type
    string
    Description

    The Single-Sign On URL as provided by the IdP.

  • Name
    idpCertificate?
    Type
    string
    Description

    The X.509 certificate as provided by the IdP.

  • Name
    idpMetadataUrl?
    Type
    string
    Description

    The URL which serves the IdP metadata. If present, it takes priority over the corresponding individual properties.

  • Name
    idpMetadata?
    Type
    string
    Description

    The XML content of the IdP metadata file. If present, it takes priority over the corresponding individual properties.

  • Name
    attributeMapping?
    Type
    { emailAddress?: string, firstName?: string, lastName?: string, userId?: string }
    Description

    The attribute mapping for the SAML connection.

  • Name
    active?
    Type
    boolean
    Description

    Indicates whether the connection is active or not.

  • Name
    syncUserAttributes?
    Type
    boolean
    Description

    Indicates whether the connection syncs user attributes between the Service Provider (SP) and Identity Provider (IdP) or not.

  • Name
    allowSubdomains?
    Type
    boolean
    Description

    Indicates whether users with an email address subdomain are allowed to use this connection in order to authenticate or not.

  • Name
    allowIdpInitiated?
    Type
    boolean
    Description

    Indicates whether the connection allows Identity Provider (IdP) initiated flows or not.

Example

In this example, the name of the SAML connection is updated.

const samlConnectionId = 'samlc_123';

const response = await clerkClient.samlConnections.updateSamlConnection(
  samlConnectionId,
  { name: 'Updated SAML Connection' }
);

console.log(response);
/*
{
  object: 'saml_connection',
  id: 'samlc_123',
  name: 'Updated SAML Connection',
  domain: 'clerk.dev',
  idp_entity_id: 'http://www.okta.com/exk...',
  idp_sso_url: 'https://trial-000000.okta.com/app/trial-000000_clerkdocstest_1/exk.../sso/saml',
  idp_certificate: 'MII...',
  idp_metadata_url: 'https://trial-000000.okta.com/app/exk.../sso/saml/metadata',
  idp_metadata: null,
  acs_url: 'https://prepared-phoenix-00.clerk.accounts.dev/v1/saml/acs/samlc_123',
  sp_entity_id: 'https://prepared-phoenix-00.clerk.accounts.dev/saml/samlc_123',
  sp_metadata_url: 'https://prepared-phoenix-00.clerk.accounts.dev/v1/saml/metadata/samlc_123.xml',
  attribute_mapping: { user_id: '', email_address: '', first_name: '', last_name: '' },
  active: false,
  provider: 'saml_okta',
  user_count: 0,
  sync_user_attributes: true,
  allow_subdomains: false,
  allow_idp_initiated: false,
  created_at: 1720032705432,
  updated_at: 1720032705432
}
*/

Backend API (BAPI) endpoint

This method in the SDK is a wrapper around the BAPI endpoint PATCH/saml_connections/{saml_connection_id}. See the BAPI reference for more details.

Feedback

What did you think of this content?