asOfflineUser
asOfflineUser(
adapter,accountId,accessToken):BoundClient
Defined in: packages/core/src/client/BoundClient.ts:107
Make API calls on behalf of a user via offline impersonation.
Used in Forge Containers and Forge Remotes where there is no live user session. The accessToken must be obtained from OfflineTokenManager (for Containers) or ForgeRemoteTokenManager (for Remotes).
Parameters
Section titled “Parameters”adapter
Section titled “adapter”The ForgeAdapter for the target product
accountId
Section titled “accountId”string
The Atlassian account ID of the user to impersonate
accessToken
Section titled “accessToken”string
The short-lived offline access token for the user
Returns
Section titled “Returns”Example
Section titled “Example”import { asOfflineUser, OfflineTokenManager } from '@forge-clients/core';import { getIssue } from '@forge-clients/jira/v3';
const tokenManager = new OfflineTokenManager({ proxyUrl, installationId });const token = await tokenManager.getToken('user-account-id');const client = asOfflineUser(adapter, token.accountId, token.accessToken);const issue = await getIssue(client, { issueIdOrKey: 'PROJ-1' });