Skip to content
Snippets Groups Projects
Commit 89730b14 authored by nahyun's avatar nahyun
Browse files

add: 토큰 만료 시간-env로 뺌. 5분 후 만료 -> 로그아웃

parent 4457153e
No related branches found
No related tags found
No related merge requests found
......@@ -132,8 +132,20 @@ app.get('/googlelogin/redirect',
const token = jwt.sign(
{ userId: req.user._id, email: req.user.email, name: req.user.name },
secretKey,
{ expiresIn: '1h' }
{ expiresIn: process.env.TOKEN_EXPIRATION }
);
//토큰 생성 정보 로깅
console.log('구글 로그인 토큰 생성:', {
토큰: token,
사용자: {
이름: req.user.name,
이메일: req.user.email,
ID: req.user._id
},
생성시간: new Date().toLocaleString()
});
res.redirect(`http://localhost:3000/login#token=${token}`);
console.log(`구글 로그인 성공: ${req.user.email}`);
}
......@@ -235,7 +247,7 @@ app.post('/login', async (req, res) => {
const token = jwt.sign(
{ userId: user._id, email: user.email, name: user.name },
secretKey,
{ expiresIn: '5m' }
{ expiresIn: process.env.TOKEN_EXPIRATION }
);
res.status(200).json({
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment