Tries context providers in order, returning the first one that succeeds. If all providers fail, throws the error from the last provider.
// Accept either API key or Bearer tokenexport const handler = onCallGenkit( { contextProvider: anyOf( requireApiKey('X-API-Key', process.env.API_KEY!), requireBearerToken(async (token) => { const user = await verifyJWT(token); return { auth: { user } }; }) ) }, myFlow); Copy
// Accept either API key or Bearer tokenexport const handler = onCallGenkit( { contextProvider: anyOf( requireApiKey('X-API-Key', process.env.API_KEY!), requireBearerToken(async (token) => { const user = await verifyJWT(token); return { auth: { user } }; }) ) }, myFlow);
Tries context providers in order, returning the first one that succeeds. If all providers fail, throws the error from the last provider.