fix json header parsing
This commit is contained in:
parent
76a4fa1d65
commit
5743a6e779
|
@ -52,7 +52,7 @@ passport.use(
|
||||||
new JWTstrategy(
|
new JWTstrategy(
|
||||||
{
|
{
|
||||||
secretOrKey: "TOP_SECRET",
|
secretOrKey: "TOP_SECRET",
|
||||||
jwtFromRequest: ExtractJwt.fromUrlQueryParameter('secret_token')
|
jwtFromRequest: ExtractJwt.fromAuthHeaderWithScheme('secret_token')
|
||||||
},
|
},
|
||||||
async (token, done) => {
|
async (token, done) => {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -36,7 +36,7 @@ router.post(
|
||||||
if (error) return next(error);
|
if (error) return next(error);
|
||||||
|
|
||||||
const body = { _id: user._id, email: user.email };
|
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 });
|
return res.json({ token });
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue