콘텐츠로 이동
한국어

BearerTokenAuth

이 콘텐츠는 아직 번역되지 않았습니다.

BearerTokenAuth(opts): Middleware

Defined in: src/http/middleware/BearerToken.ts:48

Build a Middleware that 401s every request unless the Authorization: Bearer <token> header carries one of the configured tokens. Pass it to withMiddleware(BearerTokenAuth({tokens: [...]}), route).

const protected = withMiddleware(
BearerTokenAuth({ tokens: [process.env.MGMT_TOKEN!] }),
path('cluster', concat(
path('down', post(handleDown)),
path('leave', post(handleLeave)),
)),
);

BearerTokenAuthOptions

Middleware