UserInfo type represents the authenticated user’s session information, including their profile, organization context, and permissions.
Type definition
Properties
The authenticated user object from WorkOS. Contains user profile information such as email, name, and other user attributes.
The unique identifier for the user’s session.
The ID of the organization the user is currently authenticated with, if applicable.
The user’s primary role within the organization.
An array of all roles assigned to the user within the organization.
An array of permissions granted to the user based on their roles.
An array of entitlements available to the user.
An array of feature flags enabled for the user.
Information about the admin user who is impersonating this user, if applicable. See Impersonator for details.
The JWT access token for the authenticated session.
Usage
TheUserInfo type is returned by the withAuth function when a user is authenticated:
Related types
- Session - The underlying session data structure
- NoUserInfo - Type for unauthenticated users
NoUserInfo
When a user is not authenticated, theNoUserInfo type is returned instead:
undefined when no user is authenticated, making it type-safe to check for authentication by testing the user property.