From 2b22063a81193c3d698525a050ef300e542c1f05 Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Wed, 18 Aug 2021 16:10:59 +0200 Subject: [PATCH] All authenticated entpoints now accept jwtauth --- src/server.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/server.js b/src/server.js index b03c5a1..5343532 100644 --- a/src/server.js +++ b/src/server.js @@ -257,7 +257,7 @@ fastify.post('/api/register', async (req, res) => { //Anything in here has some kind of auth fastify.after(() => { //Get url api route - fastify.get('/api/:shortcode/visits', { onRequest: fastify.auth([fastify.basicAuth]) }, async (req, res) => { + fastify.get('/api/:shortcode/visits', { onRequest: fastify.auth([fastify.basicAuth, fastify.verifyJWT]) }, async (req, res) => { const shortcode = req.params.shortcode; //This should never happen but better safe than 500 @@ -281,7 +281,7 @@ fastify.after(() => { }); //Get url api route - fastify.delete('/api/:shortcode', { onRequest: fastify.auth([fastify.basicAuth]) }, async (req, res) => { + fastify.delete('/api/:shortcode', { onRequest: fastify.auth([fastify.basicAuth, fastify.verifyJWT]) }, async (req, res) => { const shortcode = req.params.shortcode; //This should never happen but better safe than 500 @@ -298,7 +298,7 @@ fastify.after(() => { }); //Get all urls api route - fastify.get('/api', { onRequest: fastify.auth([fastify.basicAuth]) }, async (req, res) => { + fastify.get('/api', { onRequest: fastify.auth([fastify.basicAuth, fastify.verifyJWT]) }, async (req, res) => { urls = await knex.select('target', 'shortcode') .from('urls');