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.
Parameters
Section titled “Parameters”client
Section titled “client”authContext
Section titled “authContext”Returns
Section titled “Returns”Example
Section titled “Example”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' });