Skip to content

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).

ForgeAdapter

The ForgeAdapter for the target product

string

The Atlassian account ID of the user to impersonate

string

The short-lived offline access token for the user

BoundClient

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' });