Skip to content

withAuth

withAuth(client, authContext): BoundClient

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

Create a new BoundClient with a different auth context, reusing the same underlying adapter. Useful for switching auth mid-handler.

BoundClient

AuthContext

BoundClient

import { asApp, withAuth } from '@forge-clients/core';
const appClient = asApp(adapter);
// Switch to user context for certain operations:
const userClient = withAuth(appClient, { type: 'asUser', userId: 'abc' });