fix json header parsing

This commit is contained in:
andrzej 2024-05-29 15:52:57 +02:00
parent 76a4fa1d65
commit 5743a6e779
2 changed files with 2 additions and 2 deletions

View File

@ -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 {

View File

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