checkAuthz()
Posts a principal/resource authorization request to the gateway API and returns allow/deny with identity context.
Usage
The following example shows a basic usage of the backend client from @wacht/nextjs/server.
import { checkAuthz } from '@wacht/backend';export async function canAccessUsers(token: string) { return checkAuthz({ principal: { type: 'api_key', value: token }, resource: 'users/*', method: 'GET', });}Signature
function checkAuthz( payload: AuthzCheckRequest, options?: GatewayCheckAuthzOptions,): Promise<AuthzCheckResponse>Behavior
- Evaluates authorization against gateway policy and returns allow/deny context.
- Use this for backend enforcement, not only UI-level visibility checks.