> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chift.eu/llms.txt
> Use this file to discover all available pages before exploring further.

# Pre-OAuth2

Pre-OAuth2 is an add-on to the [embedded](https://docs.chift.eu/syncs/expose-to-end-users/embedded.md) model. Your backend creates the connection to your own software for your end-user. Your end-user then connects only their own software during the setup.

## Why use it

In an embedded sync, your software is the fixed side. Without pre-OAuth2, your end-user also authenticates your software on the setup page, although they are already signed in to your product.

With pre-OAuth2, you provide the credentials of the end-user for your own software directly. No OAuth2 flow runs: you own the authentication of your software, and your end-user is already connected.

> [!NOTE]
>
> The Unified API also has a pre-OAuth2 feature. It uses the same call in another context: there, you run the OAuth2 flow of a third-party software yourself. In a sync, the credentials are those of your own software.

## How it works

Pre-OAuth2 adds one call before the normal embedded flow.

**1. Create the consumer**

Create the consumer of your end-user, as in the embedded flow. See [Activating a sync](https://docs.chift.eu/syncs/expose-to-end-users/embedded/how-to-activate.md).

**2. Create the connection to your own software**

Create a connection for this consumer with the `integrationid` of your software, a `name`, and the `credentials` of the end-user.

```bash theme={null}
curl -X POST https://api.chift.eu/consumers/{consumerid}/connections \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "integrationid": 1234,
    "name": "Your software",
    "credentials": [
      { "key": "CREDENTIAL_KEY", "value": "credential-value" }
    ]
  }'
```

| Field | Notes |
| - | - |
| `integrationid` | The connector of your own software. |
| `name` | The name of the connection. Required with `credentials`. |
| `credentials` | A list of `key` and `value` pairs. [Get list of integrations](https://docs.chift.eu/api-reference/endpoints/integrations/get-list-of-integrations.md) returns the credentials that each connector expects. |

[API reference: Add new connection ↗](https://docs.chift.eu/api-reference/endpoints/connections/add-new-connection.md)

**3. Continue with the embedded flow**

Create the activation link and send your end-user to it. Your software is already connected, so your end-user connects only their own software and completes the mappings.

> [!NOTE]
>
> Chift sets up pre-OAuth2 with you. [Contact us](https://www.chift.eu/contact) to enable it for your account.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.