Skip to main content

updateEnterpriseConnection()

Updates the given enterprise connection.

Returns the updated EnterpriseConnection object.

function updateEnterpriseConnection(enterpriseConnectionId: string, params: { active?: boolean; domains?: string[]; name?: string; oidc?: { authUrl?: string; clientId?: string; clientSecret?: string; discoveryUrl?: string; requiresPkce?: boolean; tokenUrl?: string; userInfoUrl?: string }; organizationId?: string; provider?: string; saml?: { allowIdpInitiated?: boolean; allowSubdomains?: boolean; attributeMapping?: { emailAddress?: null | string; firstName?: null | string; lastName?: null | string; userId?: null | string }; forceAuthn?: boolean; idpCertificate?: string; idpEntityId?: string; idpMetadata?: string; idpMetadataUrl?: string; idpSsoUrl?: string }; syncUserAttributes?: boolean }): Promise<EnterpriseConnection>
  • Name
    enterpriseConnectionId
    Type
    string
    Description

    The ID of the enterprise connection to update.

  • Name
    params
    Type
    { active?: boolean; domains?: string[]; name?: string; oidc?: { authUrl?: string; clientId?: string; clientSecret?: string; discoveryUrl?: string; requiresPkce?: boolean; tokenUrl?: string; userInfoUrl?: string; }; organizationId?: string; provider?: string; saml?: { allowIdpInitiated?: boolean; allowSubdomains?: boolean; attributeMapping?: { emailAddress?: null | string; firstName?: null | string; lastName?: null | string; userId?: null | string; }; forceAuthn?: boolean; idpCertificate?: string; idpEntityId?: string; idpMetadata?: string; idpMetadataUrl?: string; idpSsoUrl?: string; }; syncUserAttributes?: boolean; }
    Description

    The parameters to update the enterprise connection.

  • Name
    params.active?
    Type
    boolean
    Description

    Whether the enterprise connection should be active.

  • Name
    params.domains?
    Type
    string[]
    Description

    The Verified Domains of the enterprise connection.

  • Name
    params.name?
    Type
    string
    Description

    The name of the enterprise connection.

  • Name
    params.oidc?
    Type
    { authUrl?: string; clientId?: string; clientSecret?: string; discoveryUrl?: string; requiresPkce?: boolean; tokenUrl?: string; userInfoUrl?: string; }
    Description

    Configuration for if the enterprise connection uses OAuth (OIDC).

  • Name
    params.oidc?.authUrl?
    Type
    string
    Description

    The OAuth (OIDC) authorization URL.

  • Name
    params.oidc?.clientId?
    Type
    string
    Description

    The OAuth (OIDC) client ID.

  • Name
    params.oidc?.clientSecret?
    Type
    string
    Description

    The OAuth (OIDC) client secret.

  • Name
    params.oidc?.discoveryUrl?
    Type
    string
    Description

    The OAuth (OIDC) discovery URL.

  • Name
    params.oidc?.requiresPkce?
    Type
    boolean
    Description

    Whether the OAuth (OIDC) requires PKCE. Must be true for public clients with no client secret.

  • Name
    params.oidc?.tokenUrl?
    Type
    string
    Description

    The OAuth (OIDC) token URL.

  • Name
    params.oidc?.userInfoUrl?
    Type
    string
    Description

    The OAuth (OIDC) user info URL.

  • Name
    params.organizationId?
    Type
    string
    Description

    The organization ID of the enterprise connection.

  • Name
    params.provider?
    Type
    string
    Description

    The identity provider (IdP) of the enterprise connection. For example, 'saml_custom' or 'oidc_custom'.

  • Name
    params.saml?
    Type
    { allowIdpInitiated?: boolean; allowSubdomains?: boolean; attributeMapping?: { emailAddress?: null | string; firstName?: null | string; lastName?: null | string; userId?: null | string; }; forceAuthn?: boolean; idpCertificate?: string; idpEntityId?: string; idpMetadata?: string; idpMetadataUrl?: string; idpSsoUrl?: string; }
    Description

    Configuration for if the enterprise connection uses SAML.

  • Name
    params.saml?.allowIdpInitiated?
    Type
    boolean
    Description

    Whether the SAML connection allows Identity Provider (IdP) initiated flows.

  • Name
    params.saml?.allowSubdomains?
    Type
    boolean
    Description

    Whether the SAML connection allows users with an email address subdomain to use it.

  • Name
    params.saml?.attributeMapping?
    Type
    { emailAddress?: null | string; firstName?: null | string; lastName?: null | string; userId?: null | string; }
    Description

    The attribute mapping for the SAML connection.

  • Name
    params.saml?.attributeMapping?.emailAddress?
    Type
    null | string
    Description

    The attribute mapping for the email address.

  • Name
    params.saml?.attributeMapping?.firstName?
    Type
    null | string
    Description

    The attribute mapping for the first name.

  • Name
    params.saml?.attributeMapping?.lastName?
    Type
    null | string
    Description

    The attribute mapping for the last name.

  • Name
    params.saml?.attributeMapping?.userId?
    Type
    null | string
    Description

    The attribute mapping for the user ID.

  • Name
    params.saml?.forceAuthn?
    Type
    boolean
    Description

    Whether the SAML connection requires force authentication.

  • Name
    params.saml?.idpCertificate?
    Type
    string
    Description

    The IdP certificate (PEM) for the SAML connection.

  • Name
    params.saml?.idpEntityId?
    Type
    string
    Description

    The IdP Entity ID for the SAML connection.

  • Name
    params.saml?.idpMetadata?
    Type
    string
    Description

    The raw IdP metadata XML for the SAML connection.

  • Name
    params.saml?.idpMetadataUrl?
    Type
    string
    Description

    The IdP metadata URL for the SAML connection.

  • Name
    params.saml?.idpSsoUrl?
    Type
    string
    Description

    The IdP Single-Sign On URL for the SAML connection.

  • Name
    params.syncUserAttributes?
    Type
    boolean
    Description

    Whether the enterprise connection should sync user attributes between the IdP and Clerk.

Note

Using clerkClient varies based on the SDK you're using. Refer to the overview for usage details, including guidance on how to access the userId and other properties.

const response = await clerkClient.enterpriseConnections.updateEnterpriseConnection('ec_123', {
  name: 'Google',
  provider: 'oidc_google',
  oidc: {
    authUrl: 'https://example.com/auth',
    clientId: '1234567890',
    clientSecret: '1234567890',
    discoveryUrl: 'https://example.com/discovery',
    requiresPkce: false,
    tokenUrl: 'https://example.com/token',
    userInfoUrl: 'https://example.com/userinfo',
  },
})

Backend API (BAPI) endpoint

This method in the SDK is a wrapper around the BAPI endpoint PATCH/enterprise_connections/{enterprise_connection_id}. See the BAPI reference for more information.

Feedback

What did you think of this content?

Last updated on