> For the complete documentation index, see [llms.txt](https://docs.thx.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.thx.network/developers/js-sdk/identity.md).

# Identity

<figure><img src="/files/bFaAQwjQ1clAKDfeFenI" alt=""><figcaption><p>Example of Identities in Developer -> Identity</p></figcaption></figure>

### 1. Create Identity

Create a Identity for your user and store it in your your databases user collection.

```javascript
const { THXAPIClient } = require('@thxnetwork/sdk');

const thx = new THXAPIClient({
    apiKey: '',
});

const identity = await thx.identity.create();
// e7f32a71-33ea-418e-9d80-32b6bf6405f0
```

{% hint style="success" %}
Tip: Store the identity code in the account in your database. You will need this to assign events to the same user.
{% endhint %}

#### Deterministic Identities

If you can't or don't want to store identities in your database, you can use a salt to derive a deterministic identity.

```javascript
const identity = await thx.identity.get("0x742d35Cc6634C0532925a3b844Bc454e4438f44e");
// 225a3287-ca4d-6b9d-30a2-860ab99db2fd
```

### 2. Connect Identity

Choose one the following methods to connect an Identity to a THX account.

#### 2.1. Seamless

Connect the Identity of your user to a THX account programmatically using THXWidget. As soon as the account completes a successful sign in the Identity will be connected.

```javascript
window.THXWidget.setIdentity("a6021617-9aab-4194-b2af-a4dd0cc96f84")
```

#### 2.2. Prepopulate

Connect the Identity of your user to a THX account in the frontend using your campaign widget. Users will be prompted for authentication if they are not signed in yet before they can connect.

```javascript
window.THXWidget.connect("a6021617-9aab-4194-b2af-a4dd0cc96f84")
```

#### 2.3. Manual

Share the Identity with your users and ask them to connect their identity manually using the menu item "Identities" in the navigation dropdown.

<figure><img src="/files/uCZ6L4giYOazSlg1o9qk" alt=""><figcaption><p>Example of the Identity connect view in a campaign widget</p></figcaption></figure>
