# identify

Learn how to associate the current session with a user.

This method identifies the user with an identifier that is unique to your application.

This is equivalent to calling the [`setToken`](/reference/sdk/javascript/api/plug/set-token) method, but instead of specifying the token, you provide the user ID directly and the SDK generates an [unsigned token](/explanation/application/signed-tokens#unsigned-tokens) for you.

> **Authentication**
>
> If the **Require signed token** option is enabled in the [application settings](https://app.croct.com/redirect/organizations/-organization-/workspaces/-workspace-/applications/-application-/settings), you need to use the [`setToken`](/reference/sdk/javascript/api/plug/set-token) method to provide a [signed token](/explanation/application/signed-tokens) instead.

The SDK automatically emits [`userSignedOut`](/reference/event/types/user-account/user-signed-out) and [`userSignedIn`](/reference/event/types/user-account/user-signed-in) events when the user identity changes. As a result, if the user ID changes during a session, the current session is terminated and a new session is started.

Note that calling this method issues a new token regardless of whether the specified ID is the same as the current one.

## Signature

This method has the following signature:

```ts
croct.identify(userId: string): void
```

## Example

Here is a basic example of how to use this method:

```ts
import croct from '@croct/plug';

croct.identify('00000000-0000-0000-0000-000000000000');
```

## Parameters

The following list describes the supported parameters:

- `userId`: `string`

  The ID that uniquely identifies the user in your application.

  Although the user ID can be any string, it is recommended to use a string or other globally unique identifier.
