From 5743a6e779067a1b25e2b673dbef0f0fe4f37bce Mon Sep 17 00:00:00 2001 From: andrzej Date: Wed, 29 May 2024 15:52:57 +0200 Subject: [PATCH] fix json header parsing --- auth/auth.mts | 2 +- routes/routes.mts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/auth/auth.mts b/auth/auth.mts index 8da818c..c7769f2 100644 --- a/auth/auth.mts +++ b/auth/auth.mts @@ -52,7 +52,7 @@ passport.use( new JWTstrategy( { secretOrKey: "TOP_SECRET", - jwtFromRequest: ExtractJwt.fromUrlQueryParameter('secret_token') + jwtFromRequest: ExtractJwt.fromAuthHeaderWithScheme('secret_token') }, async (token, done) => { try { diff --git a/routes/routes.mts b/routes/routes.mts index 06ce2b7..7a5e88e 100644 --- a/routes/routes.mts +++ b/routes/routes.mts @@ -36,7 +36,7 @@ router.post( if (error) return next(error); const body = { _id: user._id, email: user.email }; - const token = jwt.sign({ user: body }, 'TOP_SECRET'); + const token = jwt.sign({ user: body }, 'TOP_SECRET', { expiresIn: "20m" }); return res.json({ token }); }