fix: Change jwt expiration time from 1h to 24h

This commit is contained in:
Takeshi Kimata
2024-07-21 20:44:12 +09:00
parent 32ee0231b0
commit f03222e49c
2 changed files with 4 additions and 4 deletions

View File

@@ -27,9 +27,9 @@ module.exports = function (sequelize) {
return res.status(401).json({ error: 'Authentication failed' });
}
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 });
} catch (error) {

View File

@@ -29,9 +29,9 @@ module.exports = function (sequelize) {
});
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;
res.status(200).json({ access_token: accessToken, expires_at: expiresAt, user });