# updateEnterpriseConnection()

Updates the given enterprise connection.

Returns the updated [`EnterpriseConnection`](https://clerk.com/docs/reference/backend/types/backend-enterprise-connection.md) object.

```typescript
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>
```

## Parameters

| Parameter                                      | Type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | Description                                                                                                                       |
| ---------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| `enterpriseConnectionId`                       | `string`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | The ID of the enterprise connection to update.                                                                                    |
| `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; }` | The parameters to update the enterprise connection.                                                                               |
| `params.active?`                               | `boolean`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | Whether the enterprise connection should be active.                                                                               |
| `params.domains?`                              | `string[]`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | The [Verified Domains](https://clerk.com/docs/guides/organizations/add-members/verified-domains.md) of the enterprise connection. |
| `params.name?`                                 | `string`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | The name of the enterprise connection.                                                                                            |
| `params.oidc?`                                 | `{ authUrl?: string; clientId?: string; clientSecret?: string; discoveryUrl?: string; requiresPkce?: boolean; tokenUrl?: string; userInfoUrl?: string; }`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | Configuration for if the enterprise connection uses OAuth (OIDC).                                                                 |
| `params.oidc?.authUrl?`                        | `string`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | The OAuth (OIDC) authorization URL.                                                                                               |
| `params.oidc?.clientId?`                       | `string`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | The OAuth (OIDC) client ID.                                                                                                       |
| `params.oidc?.clientSecret?`                   | `string`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | The OAuth (OIDC) client secret.                                                                                                   |
| `params.oidc?.discoveryUrl?`                   | `string`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | The OAuth (OIDC) discovery URL.                                                                                                   |
| `params.oidc?.requiresPkce?`                   | `boolean`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | Whether the OAuth (OIDC) requires PKCE. Must be `true` for public clients with no client secret.                                  |
| `params.oidc?.tokenUrl?`                       | `string`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | The OAuth (OIDC) token URL.                                                                                                       |
| `params.oidc?.userInfoUrl?`                    | `string`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | The OAuth (OIDC) user info URL.                                                                                                   |
| `params.organizationId?`                       | `string`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | The organization ID of the enterprise connection.                                                                                 |
| `params.provider?`                             | `string`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | The identity provider (IdP) of the enterprise connection. For example, `'saml_custom'` or `'oidc_custom'`.                        |
| `params.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; }`                                                                                                                                                                                                                                                                                                            | Configuration for if the enterprise connection uses SAML.                                                                         |
| `params.saml?.allowIdpInitiated?`              | `boolean`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | Whether the SAML connection allows Identity Provider (IdP) initiated flows.                                                       |
| `params.saml?.allowSubdomains?`                | `boolean`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | Whether the SAML connection allows users with an email address subdomain to use it.                                               |
| `params.saml?.attributeMapping?`               | `{ emailAddress?: null | string; firstName?: null | string; lastName?: null | string; userId?: null | string; }`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | The attribute mapping for the SAML connection.                                                                                    |
| `params.saml?.attributeMapping?.emailAddress?` | `null | string`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | The attribute mapping for the email address.                                                                                      |
| `params.saml?.attributeMapping?.firstName?`    | `null | string`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | The attribute mapping for the first name.                                                                                         |
| `params.saml?.attributeMapping?.lastName?`     | `null | string`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | The attribute mapping for the last name.                                                                                          |
| `params.saml?.attributeMapping?.userId?`       | `null | string`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | The attribute mapping for the user ID.                                                                                            |
| `params.saml?.forceAuthn?`                     | `boolean`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | Whether the SAML connection requires force authentication.                                                                        |
| `params.saml?.idpCertificate?`                 | `string`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | The IdP certificate (PEM) for the SAML connection.                                                                                |
| `params.saml?.idpEntityId?`                    | `string`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | The IdP Entity ID for the SAML connection.                                                                                        |
| `params.saml?.idpMetadata?`                    | `string`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | The raw IdP metadata XML for the SAML connection.                                                                                 |
| `params.saml?.idpMetadataUrl?`                 | `string`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | The IdP metadata URL for the SAML connection.                                                                                     |
| `params.saml?.idpSsoUrl?`                      | `string`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | The IdP Single-Sign On URL for the SAML connection.                                                                               |
| `params.syncUserAttributes?`                   | `boolean`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | Whether the enterprise connection should sync user attributes between the IdP and Clerk.                                          |

## Usage

> Using `clerkClient` varies based on the SDK you're using. Refer to the [overview](https://clerk.com/docs/reference/backend/overview.md) for usage details, including guidance on [how to access the `userId` and other properties](https://clerk.com/docs/reference/backend/overview.md#example-get-the-user-id-and-other-properties).

```tsx
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](https://clerk.com/docs/reference/backend-api/tag/enterprise-connections/PATCH/enterprise_connections/%7Benterprise_connection_id%7D){{ target: '_blank' }} for more information.

---

## Sitemap

[Overview of all docs pages](https://clerk.com/docs/llms.txt)
