Skip to content

Graphorin API reference v0.1.0


Graphorin API reference / @graphorin/security / / authorize

Function: authorize()

ts
function authorize(result, required): 
  | {
  ok: true;
  token: VerifiedToken;
}
  | {
  ok: false;
  reason: "unauthenticated" | "insufficient-scope";
};

Defined in: packages/security/src/auth/verify.ts:387

Helper that authorises a parsed verify result against a required scope. Keeps the scope plumbing close to the rest of the auth surface so callers do not have to import from two places.

Parameters

ParameterType
resultVerifyResult
required| string | ParsedScope

Returns

| { ok: true; token: VerifiedToken; } | { ok: false; reason: "unauthenticated" | "insufficient-scope"; }

Stable