# Adding a new authentication method

## Introduction

The connector builder [supports a range of authentication types](https://doc.wearepatchworks.com/product-documentation/developer-hub/connector-builder/building-your-own-connector/3-authentication-methods/supported-authentication-types). Before a connector can be used (i.e. before [instances of it can be added](https://doc.wearepatchworks.com/product-documentation/connectors-and-instances/working-with-instances/adding-an-instance) for use in [process flows](https://doc.wearepatchworks.com/product-documentation/process-flows/about-process-flows)) you must add at least one **authentication method** for your connector.&#x20;

The [steps and settings](https://doc.wearepatchworks.com/product-documentation/developer-hub/connector-builder/building-your-own-connector/3-authentication-methods/authentication-method-options) required will vary depending on which **authentication type** you choose to configure, but the general process is straightforward.

{% hint style="info" %}
Please refer to your API documentation for specific **authentication** requirements for your own third-party application.
{% endhint %}

## What you need to do

General steps are provided below, with links to detailed guidance for each of our [supported authentication types](https://doc.wearepatchworks.com/product-documentation/developer-hub/connector-builder/building-your-own-connector/3-authentication-methods/supported-authentication-types).

**Step 1** \
Click the **add new authentication method** button:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FlbNXRxJV3X0yw0jK3w3e%2Fauth%202.png?alt=media&#x26;token=49250ef9-9ab7-4c30-b1ec-d61d88cdd8ec" alt=""><figcaption></figcaption></figure></div>

**Step 2** \
You're prompted to enter some basic details for this authentication method:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FDoGxHRcW5Yb0wn886i0R%2Fauth%204.png?alt=media&#x26;token=82587994-788a-4d45-b097-145a8ee8d2b5" alt=""><figcaption></figcaption></figure></div>

Complete these details using the table below as a guide:

| Field                      | Summary                                                                                                                                       |
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| Enter a name               | Enter the name to be displayed for this connector throughout Patchworks.                                                                      |
| Select authentication type | Use the dropdown list to select the required authentication type. The selection made here determines subsequent settings and default options. |

**Step 3** \
Click the **create** button to confirm your updates. Basic details are saved and additional setup options are displayed over a series of 'metro stop' tabs - for example:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FMBXy1ymQtH0YFYlxqB0t%2Fauth%205.png?alt=media&#x26;token=4e2db9a8-8511-4ccd-81ad-d36dccafee1d" alt=""><figcaption></figcaption></figure></div>

**Step 4** \
Step through each tab and [set configuration options](#configuring-an-authentication-method) as appropriate for your chosen authentication method.

## Configuring an authentication method

For any authentication method, the following configuration options are available:

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F0ma9PYS0afgonFUJSb3a%2F1.png?alt=media&#x26;token=803a691a-0e98-4e6f-aa95-0ae793f8d562" alt="" data-size="line"> Authentication variables</summary>

Define authentication variables for any values that you need users to provide when they choose to [add an instance](https://doc.wearepatchworks.com/product-documentation/connectors-and-instances/working-with-instances/adding-an-instance) of this connector (for use in [process flows](https://doc.wearepatchworks.com/product-documentation/process-flows/about-process-flows)). Here, you define how fields for these variables are displayed to your users (so they can provide required values), and then how these details are passed in API requests for authentication.&#x20;

Required variables depend on your selected authentication type - refer to the API documentation for the underlying third-party application for guidance on this.

For more information about working with **authentication variables** generally, please see the [Auth variables](https://doc.wearepatchworks.com/product-documentation/developer-hub/connector-builder/building-your-own-connector/3-authentication-methods/authentication-method-options/auth-variables) page. For guidance on configuring specific **authentication types**, please see our [Supported authentication types](https://doc.wearepatchworks.com/product-documentation/developer-hub/connector-builder/building-your-own-connector/3-authentication-methods/supported-authentication-types) section.

</details>

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F83qvL3DjjvsmiVUYlQiQ%2F2.png?alt=media&#x26;token=dc06fd43-5913-462a-b256-101b3f76867e" alt="" data-size="line"> Connector variables</summary>

These are 'shared' variables that can be used when defining authentication methods and endpoints for your connector. So, if you have a variable that might be used in multiple [authentication methods](https://doc.wearepatchworks.com/product-documentation/developer-hub/connector-builder/building-your-own-connector/3-authentication-methods/authentication-method-options/auth-variables), or multiple [endpoints](https://doc.wearepatchworks.com/product-documentation/developer-hub/connector-builder/building-your-own-connector/4-endpoints/endpoint-options/endpoint-variables), or both - define them here for quick access later. &#x20;

For more information about working with **connector variables** generally, please see the [Connector variables](https://doc.wearepatchworks.com/product-documentation/developer-hub/connector-builder/building-your-own-connector/3-authentication-methods/authentication-method-options/connector-variables) page. For guidance on configuring specific **authentication types**, please see our [Supported authentication types](https://doc.wearepatchworks.com/product-documentation/developer-hub/connector-builder/building-your-own-connector/3-authentication-methods/supported-authentication-types) section.

</details>

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FVCQL42m29ZL1W1x3Q9aW%2F3.png?alt=media&#x26;token=7b70814f-ab70-4b5f-9cae-65c9dcf89da7" alt="" data-size="line"> URL parameters</summary>

**URL parameters** are used to apply queries/filters to authentication requests. In reality, URL parameters are not commonly used in authentication methods because it's very easy to just apply queries to the request URL directly.

For more information about working with **URL parameters** generally, please see the [URL parameters](https://doc.wearepatchworks.com/product-documentation/developer-hub/connector-builder/building-your-own-connector/3-authentication-methods/authentication-method-options/url-parameters) page. For guidance on configuring specific **authentication types**, please see our [Supported authentication types](https://doc.wearepatchworks.com/product-documentation/developer-hub/connector-builder/building-your-own-connector/3-authentication-methods/supported-authentication-types) section.

</details>

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Fj27NPzQQFoRlKRDAmmsj%2F4.png?alt=media&#x26;token=482820e7-110b-4469-9da4-88339e687f6c" alt="" data-size="line"> Header</summary>

Any variables that need to be passed in authentication request headers should be added here, as per the [API documentation for the underlying third-party application](#user-content-fn-1)[^1]. &#x20;

For more information about working with **header variables** generally, please see the [Header](https://doc.wearepatchworks.com/product-documentation/developer-hub/connector-builder/building-your-own-connector/3-authentication-methods/authentication-method-options/header) page. For guidance on configuring specific **authentication types**, please see our [Supported authentication types](https://doc.wearepatchworks.com/product-documentation/developer-hub/connector-builder/building-your-own-connector/3-authentication-methods/supported-authentication-types) section.

</details>

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FxWO0mmwxJfEEmqcJZvM9%2F5.png?alt=media&#x26;token=72398fcd-7d39-4a4b-b718-36792c786dec" alt="" data-size="line"> Body</summary>

Any variables that need to be passed in the authentication request body should be added here, as per the API documentation for the underlying third-party application. &#x20;

For more information about working with **body options** generally, please see the [Body](https://doc.wearepatchworks.com/product-documentation/developer-hub/connector-builder/building-your-own-connector/3-authentication-methods/authentication-method-options/body) page. For guidance on configuring specific **authentication types**, please see our [Supported authentication types](https://doc.wearepatchworks.com/product-documentation/developer-hub/connector-builder/building-your-own-connector/3-authentication-methods/supported-authentication-types) section.

</details>

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FPCaiaYtOfqGTkWgIFzrF%2F6.png?alt=media&#x26;token=2a400a71-222a-4a79-b3e3-59e4d3eb958d" alt="" data-size="line"> Pre-request script</summary>

Pre-request scripts allow you to modify authentication request parameters before sending the actual request. You can set dynamic values, compute signatures, or add headers based on specific conditions. &#x20;

For more information please see the [Pre-request script](https://doc.wearepatchworks.com/product-documentation/developer-hub/connector-builder/building-your-own-connector/3-authentication-methods/authentication-method-options/pre-request-script) page.&#x20;

</details>

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F4rSuY2TCJ3a0mHWqbNty%2F7.png?alt=media&#x26;token=db3c692b-1fac-4088-a668-7e5b604eae6d" alt="" data-size="line"> Post-request script</summary>

**Post-request scripts** are useful for manipulating the response data before displaying or using it. You can extract specific values, format data, or even perform calculations. This helps in preparing the response data for further requests, or for displaying in a more user-friendly manner.

For more information please see the [Pre-request script](https://doc.wearepatchworks.com/product-documentation/developer-hub/connector-builder/building-your-own-connector/3-authentication-methods/authentication-method-options/pre-request-script) page.&#x20;

</details>

[^1]: ![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F7ebRB4tRIozWxpBMCAoN%2Ficons8-google-docs-20.svg?alt=media\&token=ac61da4e-764c-452c-b9b5-d65f188769c9) You should be able to confirm this information in the API documentation for the underlying third-party application.&#x20;
