> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# EnableConnection

# Package: headless

# Namespace: ConnectionsService

# Method link: https://dev.wix.com/docs/api-reference/business-management/headless/connections/enable-connection.md

## Permission Scopes:
SCOPE.IDENTITY.MANAGE-SSO-SITE: SCOPE.IDENTITY.MANAGE-SSO-SITE

## Introduction

Enables a connection for user authentication.

This activates a previously created connection, making it available for users to sign in with.
Calling this method for a connection that's already enabled succeeds, and the connection stays enabled.
To deactivate the connection, call [Disable Connection](https://dev.wix.com/docs/api-reference/wix-backoffice/identity/connection-v1/disable-connection.md).

> **Note:** The connection ID isn't validated. If no connection exists with the specified ID, the call still succeeds,
> but no sign-in option is added. To verify that the connection was enabled, call
> [List Enabled Connections Client Data](https://dev.wix.com/docs/api-reference/wix-backoffice/identity/connection-v1/list-enabled-connections-client-data.md)
> and check that the connection appears in the response.

---

## REST API

### Schema

```
 Method: enableConnection
 Description: Enables a connection for user authentication.  This activates a previously created connection, making it available for users to sign in with. Calling this method for a connection that's already enabled succeeds, and the connection stays enabled. To deactivate the connection, call [Disable Connection](https://dev.wix.com/docs/api-reference/wix-backoffice/identity/connection-v1/disable-connection.md).  > **Note:** The connection GUID isn't validated. If no connection exists with the specified GUID, the call still succeeds, > but no sign-in option is added. To verify that the connection was enabled, call > [List Enabled Connections Client Data](https://dev.wix.com/docs/api-reference/wix-backoffice/identity/connection-v1/list-enabled-connections-client-data.md) > and check that the connection appears in the response.
 URL: https://www.wixapis.com/iam/connection/v1/connections/enabled
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  connectionId
 Method parameters: 
   param name: connectionId | type: connectionId | description: Connection GUID. | required: true | validation: format GUID
 Return type: EnableConnectionResponse
  EMPTY-OBJECT {}


```

### Examples

### Enable a connection
Activates a previously created connection so users can sign in with it. The connection ID is passed in the request body; the response is empty on success.

```curl
curl -X POST \
'https://www.wixapis.com/iam/connection/v1/connections/enabled' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "connectionId": "2f3c8a1e-0b7d-4e2a-9c11-8a1e0b7d4e2a"
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.identity.connection.enableConnection(connectionId)
 Description: Enables a connection for user authentication.  This activates a previously created connection, making it available for users to sign in with. Calling this method for a connection that's already enabled succeeds, and the connection stays enabled. To deactivate the connection, call [Disable Connection](https://dev.wix.com/docs/api-reference/wix-backoffice/identity/connection-v1/disable-connection.md).  > **Note:** The connection GUID isn't validated. If no connection exists with the specified GUID, the call still succeeds, > but no sign-in option is added. To verify that the connection was enabled, call > [List Enabled Connections Client Data](https://dev.wix.com/docs/api-reference/wix-backoffice/identity/connection-v1/list-enabled-connections-client-data.md) > and check that the connection appears in the response.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  connectionId
 Method parameters: 
   param name: connectionId | type: string | description: Connection GUID. | required: true | validation: format GUID
 Return type: PROMISE<EnableConnectionResponse>
  EMPTY-OBJECT {}


```

### Examples

### Enable a connection
Activates a previously created connection for user authentication.

```javascript
import { connection } from "@wix/identity";

async function enableConnection() {
  const response = await connection.enableConnection(
    "2f3c8a1e-0b7d-4e2a-9c11-8a1e0b7d4e2a",
  );
}

/* Promise resolves to:
 * {}
 */

```

### enableConnection (self-hosted)
Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { connection } from '@wix/identity';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { connection },
  // Include the auth strategy and host as relevant
});


async function enableConnection(connectionId) {
  const response = await myWixClient.connection.enableConnection(connectionId);
};
```

---