Use an Identity to assign Events in your system to THX users and build quests around it. Learn how to connect an Identity to a THX account using your campaign widget.

1. Create Identity

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

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

const thx = new THXAPIClient({
    clientId: '',
    clientSecret: ''

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

Tip: Store the identity code in the account in your database. You will need this to assign events to the same user.

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.

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.


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.


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.

Last updated