From cddcfd6cb188d18b9a0b1eaf1294e2701c2e78b5 Mon Sep 17 00:00:00 2001 From: Frazer Smith Date: Mon, 27 Jan 2025 12:49:45 +0000 Subject: [PATCH] fix(index): register as `preHandler` hook Signed-off-by: Frazer Smith --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index d5e3108..e2159af 100644 --- a/index.js +++ b/index.js @@ -27,7 +27,7 @@ function fastifyBearerAuth (fastify, options, done) { try { if (options.addHook === true) { - fastify.addHook('onRequest', verifyBearerAuthFactory(options)) + fastify.addHook('preHandler', verifyBearerAuthFactory(options)) } else { fastify.decorate('verifyBearerAuthFactory', verifyBearerAuthFactory) fastify.decorate('verifyBearerAuth', verifyBearerAuthFactory(options))