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 option to keep the Croct user in sync with your authentication system.

Definition

This type has the following shape:

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

The function receives the H3 event and returns the user ID, or null for anonymous users. It may be synchronous or asynchronous.