@webtask/bearer-auth-middleware v1.5.2
Bearer auth middleware
The bearer auth middleware is a generic bearer token authentication solution for webtasks. A request to a webtask configured with this middleware will be rejected with a 401 response if it lacks the correct bearer token.
Usage
To use the bearer auth middleware requires encoding a shared secret in the wt-auth-secret secret that must be specified in Authentication: Bearer <SHARED_SECRET> headers.
Set the
wt-node-dependenciesmetadata property to the stringified JSON of an object having@webtask/middleware-compilerand@webtask/bearer-auth-middlewareproperties whose values are the latest version of the @webtask/middleware-compiler module and this module, respectively.{"@webtask/middleware-compiler":"1.1.0","@webtask/bearer-auth-middleware":"1.1.0"}Set the
wt-compilermetadata property on your webtask to@webtask/middleware-compiler.Set (or add to) the
wt-middlewaremetadata property of your webtask to contain a comma-separated list containing@webtask/bearer-auth-middleware.Set the
wt-auth-secretsecret to a shared secret.Issue requests to your webtask, making sure that you add an
Authorizationheader having the value:Bearer <SHARED_SECRET>.