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.accountIdas the userId.
Parameters
Section titled “Parameters”adapter
Section titled “adapter”The ForgeAdapter for the target product
userId?
Section titled “userId?”string
Optional Atlassian account ID. If omitted, Forge uses the invoking user’s identity automatically.
Returns
Section titled “Returns”Example
Section titled “Example”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);