diff --git a/app.js b/app.js index 5c204821ec7ecc5d1fa68bdb59b3257d1f1a9aee..4c8413a914db1787a9db38feab1bb7449b47396a 100644 --- a/app.js +++ b/app.js @@ -97,16 +97,6 @@ app.use('/del_user', authenticateToken, deleteUser); console.log('GOOGLE_CLIENT_ID:', process.env.GOOGLE_CLIENT_ID); console.log('GOOGLE_CLIENT_SECRET:', process.env.GOOGLE_CLIENT_SECRET); - - - -// // MongoDB 연결 -// mongoose.connect('mongodb://localhost:27017/logininfo', { -// useNewUrlParser: true, -// useUnifiedTopology: true, -// }).then(() => console.log('MongoDB 연결 성공')) -// .catch(err => console.error('MongoDB 연결 오류:', err)); - // application/x-www-form-urlencoded app.use(express.urlencoded({ extended: false })); @@ -140,7 +130,7 @@ app.get('/googlelogin', passport.authenticate('google', { scope: ['profile', 'email'], session: false }) ); -//jwt 전-------------------------------------- +//세션 로그인 ------------------------------------- // app.get('/googlelogin/redirect', // passport.authenticate('google', { failureRedirect: '/' }), // (req, res) => { @@ -194,7 +184,6 @@ app.get('/googlelogin/redirect', sameSite: 'Strict', maxAge: 7 * 24 * 60 * 60 * 1000 // 7일 }); - //res.redirect(`http://localhost:3000/login#token=${token}`); res.redirect('https://localhost:3000/'); console.log(`구글 로그인 성공: ${req.user.email}`); } @@ -280,20 +269,13 @@ app.get('/dashboard', authenticateToken, (req, res) => { `); }); -// // 홈 -// app.get('/', (req, res) => { -// res.send(` -// <h1>Google OAuth Login</h1> -// <a href="/googlelogin">Login with Google</a> -// `); -// }); //signup 경로 app.get('/signup', (req, res) => { res.sendFile(__dirname + '/public/signup.html'); // login.html 파일 경로 설정 }); -//session +//session 로그인 // app.get('/conf_password', (req, res) => { // if (req.isAuthenticated && req.isAuthenticated()) { // 로그인 여부 확인