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.
| Field | Type | Description |
|---|---|---|
user | User! | — |
account | Account! | — |
isTwoFactorValidated | Boolean! | 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
viewerReturns the currently authenticated user's session context, including permissions and 2FA status.
type Query {
viewer: Viewer!
}Arguments
No arguments.
Returns
Mutations
Root mutations that create, update, or otherwise change this object.
switchUser
switchUserSwitches the current session to act as a different user. Admin only. Audit-logged.
type Mutation {
switchUser(input: SwitchUserInput!): SwitchUserPayload!
}Arguments
| Argument | Type | Description |
|---|---|---|
input | SwitchUserInput! | — |
Returns
Related types
Supporting objects, inputs, and enums used by this page.
Objects
PermissionWithScope
PermissionWithScopeType: object
A permission name paired with its effective scope for the current viewer.
Fields
| Field | Type | Description |
|---|---|---|
permissionName | String! | — |
scope | RoleScope! | — |
SwitchUserPayload
SwitchUserPayloadType: object
Response payload for the switchUser mutation.
Fields
| Field | Type | Description |
|---|---|---|
token | String! | New JWT session token for the switched user context. |
Inputs
SwitchUserInput
SwitchUserInputType: input
Input for switching to a different user's context.
Fields
| Field | Type | Description |
|---|---|---|
userID | String! | — |

