@webtask/cron-auth-middleware v1.2.3
Cron auth middleware
The cron auth middleware provides a simple cron authentication mechanism so that the Webtask cron daemon is able to make authenticated requests but third parties cannot.
Usage
To use the cron auth middleware leverages the fact that the Webtask cron daemon will invoke cron webtasks with an Authentication header having a bearer token corresponding to the underlying webtask token of that cron job.
Set the
wt-node-dependenciesmetadata property to the stringified JSON of an object having@webtask/middleware-compilerand@webtask/cron-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/cron-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/cron-auth-middleware.Schedule the webtask to run periodically and note that requests lacking an appropriate
Authorizationheader will fail with a401response.