updated the expiration of token from 1h to 1day
This commit is contained in:
+1
-1
@@ -28,7 +28,7 @@ router.post("/login", (req, res) => {
|
|||||||
let jwtSecretKey = process.env.JWT_SECRET_KEY || "defaultSecretKey";
|
let jwtSecretKey = process.env.JWT_SECRET_KEY || "defaultSecretKey";
|
||||||
let data = { userId: user.id, username: user.username };
|
let data = { userId: user.id, username: user.username };
|
||||||
|
|
||||||
const token = jwt.sign(data, jwtSecretKey, { expiresIn: "1h" });
|
const token = jwt.sign(data, jwtSecretKey, { expiresIn: "1d" });
|
||||||
return res.json({ token });
|
return res.json({ token });
|
||||||
} else {
|
} else {
|
||||||
return res.status(401).send("Invalid credentials");
|
return res.status(401).send("Invalid credentials");
|
||||||
|
|||||||
Reference in New Issue
Block a user