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 }); }