# UserIdResolver

Learn about the function that resolves the user ID.

This type describes the function the SDK uses to resolve the ID of the logged-in user for a request.

Provide one through the [`userIdResolver`](/reference/sdk/nuxt/api/configuration#useridresolver-prop) option to keep the Croct user in sync with your authentication system.

## Definition

This type has the following shape:

```ts
type UserIdResolver = (event: H3Event) => Promise<string | null> | string | null;
```

The function receives the [H3 event](https://h3.unjs.io/guide/event) and returns the user ID, or `null` for anonymous users. It may be synchronous or asynchronous.
