Skip to content

asUser

asUser(adapter, userId?): BoundClient

Defined in: packages/core/src/client/BoundClient.ts:78

Make API calls on behalf of the currently logged-in user.

  • In Forge Functions: the invoking user’s identity is used automatically when no userId is provided.
  • In Custom UI / UI Kit 2: user identity is managed by the bridge.
  • In Forge Remotes: pass payload.context.accountId as the userId.

ForgeAdapter

The ForgeAdapter for the target product

string

Optional Atlassian account ID. If omitted, Forge uses the invoking user’s identity automatically.

BoundClient

import { asUser } from '@forge-clients/core';
import { getMyself } from '@forge-clients/jira/v3';
// Without userId — uses the invoking user:
const client = asUser(adapter);
const me = await getMyself(client);
// With explicit userId (e.g. from a Forge Remote payload):
const client = asUser(adapter, payload.context.accountId);