# OAuth 1 authentication

## Introduction

When a user chooses to [add a connector instance](https://doc.wearepatchworks.com/product-documentation/connectors-and-instances/working-with-instances/adding-an-instance) using **OAuth 1** authentication, they are required to enter the following credentials: &#x20;

| Credential            | Notes                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `Consumer key`        | Generated in Netsuite as part of your initial Patchworks integration. For more information see: [Consumer key & consumer secret.](#consumer-key-and-consumer-secret)                                                                                                                                                                                                                                                                                                                 |
| `Consumer secret`     | Generated in Netsuite as part of your initial Patchworks integration. For more information see: [Consumer key & consumer secret.](#consumer-key-and-consumer-secret)                                                                                                                                                                                                                                                                                                                 |
| `Account id`          | This is always the first element of the URL that you can see having logged into NetSuite. For more information see: [Consumer key & consumer secret.](#consumer-key-and-consumer-secret)                                                                                                                                                                                                                                                                                             |
| `Token`               | Generated per user in Netsuite. For more information see: [Token key & token secret](#token-key-and-token-secret).                                                                                                                                                                                                                                                                                                                                                                   |
| `Token secret`        | Generated per user in Netsuite. For more information see: [Token key & token secret](#token-key-and-token-secret).                                                                                                                                                                                                                                                                                                                                                                   |
| `Signature algorithm` | Always set to `sha256`.                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `Signature method`    | Always set to `HMAC-SHA256`.                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `Realm`               | <p>For a NetSuite sandbox the <code>accountid</code> shown in NetSuite (as opposed to your NetSuite URL) typically includes an <code>-SB</code> element - for example: <code>1234567-SB1</code>.</p><p></p><p>The <code>realm</code> will be the same value EXCEPT that the <code>-SB</code> element changes from a dash to an underscore. </p><p></p><p>So, an <code>accountid</code> of <code>1234567-SB1</code> becomes <code>1234567\_SB1</code> for the <code>realm</code>.</p> |

## Setting up OAuth 1 authentication

In order to add connector instances for NetSuite using OAuth 1 authentication, you must have completed all generic setup detailed in our [Preparing your NetSuite environment to work with Patchworks](https://doc.wearepatchworks.com/product-documentation/connectors-and-instances/patchworks-connectors/netsuite-prebuilt-connector/preparing-your-netsuite-environment-to-work-with-patchworks) guide.&#x20;

## Finding your credentials

{% hint style="warning" %}
If you are using a custom version of our prebuilt NetSuite connector (i.e. if authentication method and/or endpoint settings have been updated after the original installation), please be aware that your settings and requirements may vary.
{% endhint %}

### Consumer key & consumer secret

If you have followed our [Preparing your NetSuite environment to work with Patchworks](https://doc.wearepatchworks.com/product-documentation/connectors-and-instances/patchworks-connectors/netsuite-prebuilt-connector/preparing-your-netsuite-environment-to-work-with-patchworks) guide, you will have added a Patchworks integration and saved your client credentials (`consumer key`/`client id` and `consumer secret`/`client secret`) to a password manager.&#x20;

If you can't find these credentials, a new set can be generated.

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FpLMO12yvTCxi9PorCt53%2Ficons8-film.svg?alt=media&#x26;token=e59864bc-2d97-4f98-966c-a083c18e60db" alt="" data-size="line"> Show me</summary>

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FXPhbvWik2nwJvshe1R53%2Fconsumer%20key%20and%20secret.gif?alt=media\&token=fa678870-5c7b-4112-9d14-eb9af2699041)

</details>

{% hint style="danger" %}
Be aware that if you reset credentials that have already been used to configure Patchworks [connector instances](https://doc.wearepatchworks.com/product-documentation/connectors-and-instances/working-with-instances/adding-an-instance), process flows will fail until you [apply the new credentials](https://doc.wearepatchworks.com/product-documentation/connectors-and-instances/working-with-instances/updating-an-instance).&#x20;
{% endhint %}

### Account ID

This is always the first element of the URL that you can see having logged into NetSuite. For example, with the following URL: \
\
`https://tstdrv1431250.app.netsuite.com/app/center/card.nl?sc=-29&whence=`

...the **account id** would be:\
\
`tstdrv1431250`

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FpLMO12yvTCxi9PorCt53%2Ficons8-film.svg?alt=media&#x26;token=e59864bc-2d97-4f98-966c-a083c18e60db" alt="" data-size="line"> Show me</summary>

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F109sSVYUlweamWkXU5Lf%2Faccountid.gif?alt=media\&token=067beca8-c7f0-456b-be5a-53bab70bffb8)

</details>

### **Token key & token secret**

A **token key** and **token secret** can be generated for users with a Patchworks integration role. In NetSuite, navigate to `setup` <mark style="color:red;">|</mark> `users/roles` <mark style="color:red;">|</mark> `access tokens`.

These values should be added to a password manager at the time they are generated as they can't be re-accessed in NetSuite. If you can't find these credentials, a new set can be generated.

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FpLMO12yvTCxi9PorCt53%2Ficons8-film.svg?alt=media&#x26;token=e59864bc-2d97-4f98-966c-a083c18e60db" alt="" data-size="line"> Show me</summary>

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Fedv9T878JwgLHJao28Sp%2Fgenerate%20tokens.gif?alt=media\&token=213033af-ad66-40a5-a712-0ed0f241fcff)

</details>

{% hint style="danger" %}
Be aware that if you reset credentials that have already been used to configure Patchworks [connector instances](https://doc.wearepatchworks.com/product-documentation/connectors-and-instances/working-with-instances/adding-an-instance), process flows will fail until you [apply the new credentials](https://doc.wearepatchworks.com/product-documentation/connectors-and-instances/working-with-instances/updating-an-instance).&#x20;
{% endhint %}
