Skip to content

Graphorin API reference v0.1.0


Graphorin API reference / @graphorin/server / / createAuthMiddleware

Function: createAuthMiddleware()

ts
function createAuthMiddleware(options): MiddlewareHandler<{
  Variables: ServerVariables;
}>;

Defined in: packages/server/src/middleware/auth.ts:108

Build the bearer-token middleware. The middleware always sets c.var.state.auth, even on the unauthenticated branch, so downstream code can pattern-match the discriminated union without a separate "is anonymous?" check.

Parameters

ParameterType
optionsAuthMiddlewareOptions

Returns

MiddlewareHandler<{ Variables: ServerVariables; }>

Stable