Zum Inhalt springen
Deutsch

BearerTokenAuth

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

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