Viewer

Authenticated session context for the current user.

Viewer

The currently authenticated session context. Provides the logged-in user,
their account, 2FA status, and the aggregated permissions granted to them.

Fields

Fields on the Viewer object.

FieldTypeDescription
userUser!
accountAccount!
isTwoFactorValidatedBoolean!Whether the user has completed two-factor authentication for this session.
grantedPermissionsWithScope[PermissionWithScope!]!All permissions granted to the viewer, each with its effective scope.
grantableRoles[Role!]!Roles the viewer is allowed to grant to other users, based on the viewer's own permissions.

Queries

Root queries that return or operate on this object.

viewer

Returns the currently authenticated user's session context, including permissions and 2FA status.

type Query {
  viewer: Viewer!
}

Arguments

No arguments.

Returns

Viewer

Mutations

Root mutations that create, update, or otherwise change this object.

switchUser

Switches the current session to act as a different user. Admin only. Audit-logged.

type Mutation {
  switchUser(input: SwitchUserInput!): SwitchUserPayload!
}

Arguments

ArgumentTypeDescription
inputSwitchUserInput!

Returns

SwitchUserPayload

Related types

Supporting objects, inputs, and enums used by this page.

Objects

PermissionWithScope

Type: object

A permission name paired with its effective scope for the current viewer.

Fields
FieldTypeDescription
permissionNameString!
scopeRoleScope!

SwitchUserPayload

Type: object

Response payload for the switchUser mutation.

Fields
FieldTypeDescription
tokenString!New JWT session token for the switched user context.

Inputs

SwitchUserInput

Type: input

Input for switching to a different user's context.

Fields
FieldTypeDescription
userIDString!