跳转到内容
简体中文

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