# Identify logged-in users in the support chat

If your app has sign-in, you can link the signed-in member to a quiry customer. The customer does not have to type an email again, and the console shows them as a **Member** on the customer detail. Create a signature of the member id on your server and pass it to `Quiry.identify` in the browser.

## Before you start

1. On the site's **Install** tab, under **Connect logged-in users**, copy the **Signing secret**.
2. Put it in your app server's environment variables. You can name it anything, for example `QUIRY_IDENTITY_SECRET`.
3. The widget must already be installed. If not, start with [Install the widget](/docs/install).

## Create the signature on the server

The signature is the member id signed with the signing secret using HMAC SHA-256. Create it on the server only.

```
import { createHmac } from "node:crypto";
const hash = createHmac("sha256", process.env.QUIRY_IDENTITY_SECRET).update(String(user.id)).digest("hex");
// Browser: Quiry.identify({ id: user.id, email: user.email, name: user.name, hash })
```

## Prompt to give a coding AI

```
Link the signed-in members of this app to the quiry support chat. Follow the section "Connect logged-in users" in https://quiry.me/en/docs/install.md.
1. On the server, create hash by signing the member id with HMAC SHA-256 using the signing secret (environment variable QUIRY_IDENTITY_SECRET).
2. After sign-in finishes, call Quiry.identify({ id, email, name, hash }) in the browser.
3. Never put the signing secret in browser code, the repository, or the client bundle.
```

## Rules to keep

- `hash` is required. If it is missing or wrong, the member link is ignored and the customer stays anonymous.
- The signature covers the member id only. The name and email are not protected by it.
- There is no call to announce sign-out. When a member signs out, reload the page so the widget starts again without member info.
- If the secret leaks, choose **Regenerate secret** and change the value on your server too. Existing signatures stop working right away.

## Check it

While signed in, send a test message and check in the console under **Customers** that the customer shows as a **Member**. If it shows as anonymous, first check that the server creates `hash` correctly.

For apps that use Supabase Auth, such as Lovable apps, also see [Add a support chat to your Lovable app](/docs/lovable).

Next is [Reply to users by email after they leave](/docs/email-reply).
