fix: Change jwt expiration time from 1h to 24h
This commit is contained in:
@@ -27,9 +27,9 @@ module.exports = function (sequelize) {
|
|||||||
return res.status(401).json({ error: 'Authentication failed' });
|
return res.status(401).json({ error: 'Authentication failed' });
|
||||||
}
|
}
|
||||||
const accessToken = jwt.sign({ userId: user.id }, secretKey, {
|
const accessToken = jwt.sign({ userId: user.id }, secretKey, {
|
||||||
expiresIn: '1h',
|
expiresIn: '24h',
|
||||||
});
|
});
|
||||||
const expiresAt = Date.now() + 3600 * 1000; // expire date(ms)
|
const expiresAt = Date.now() + 3600 * 1000 * 24; // expire date(ms)
|
||||||
|
|
||||||
res.status(200).json({ access_token: accessToken, expires_at: expiresAt, user });
|
res.status(200).json({ access_token: accessToken, expires_at: expiresAt, user });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -29,9 +29,9 @@ module.exports = function (sequelize) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const accessToken = jwt.sign({ userId: user.id }, secretKey, {
|
const accessToken = jwt.sign({ userId: user.id }, secretKey, {
|
||||||
expiresIn: '1h',
|
expiresIn: '24h',
|
||||||
});
|
});
|
||||||
const expiresAt = Date.now() + 3600 * 1000; // expire date(ms)
|
const expiresAt = Date.now() + 3600 * 1000 * 24; // expire date(ms)
|
||||||
|
|
||||||
user.password = undefined;
|
user.password = undefined;
|
||||||
res.status(200).json({ access_token: accessToken, expires_at: expiresAt, user });
|
res.status(200).json({ access_token: accessToken, expires_at: expiresAt, user });
|
||||||
|
|||||||
Reference in New Issue
Block a user