ready to test

Testing

Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
2026-06-22 10:06:58 +08:00
parent bf48c95467
commit 439bb33f77
189 changed files with 17559 additions and 686 deletions
+6 -16
View File
@@ -13,15 +13,14 @@
* POST /api/auth/refresh → refresh access token
* POST /api/auth/logout → logout (requires authenticate)
* POST /api/auth/change-password → change password (requires authenticate)
* GET /api/auth/google → initiate Google OAuth
* GET /api/auth/google/callback → Google OAuth callback
* GET /api/auth/google → initiate Google OIDC (generates state/nonce/PKCE)
* GET /api/auth/google/callback → Google OIDC callback (verifies + exchanges code)
*
* Author: rgrgogu
* Date Created: Oct. 6, 2025
***********************************************************************************************************************************************************************/
const express = require('express');
const passport = require('passport');
const router = express.Router();
const router = express.Router();
const authCtrl = require('../controllers/auth.controller');
const { authenticate } = require('../middleware/auth.middleware');
@@ -45,17 +44,8 @@ router.post('/refresh', authCtrl.refreshToken);
router.post('/logout', authenticate, authLimiter, authCtrl.logout);
router.post('/change-password', authenticate, sensitiveOpsLimiter, ...changePassValidator, validate, authCtrl.changePassword);
// ── Google OAuth ───────────────────────────────────────────────────────────────
router.get('/google',
authLimiter,
passport.authenticate('google', { scope: ['profile', 'email'], session: false })
);
router.get('/google/callback',
passport.authenticate('google', { session: false, failureRedirect: '/api/auth/google/failed' }),
authCtrl.googleCallback
);
router.get('/google/failed', (req, res) => {
res.status(401).json({ status: 'error', message: 'Google authentication failed.' });
});
// ── Google OIDC ────────────────────────────────────────────────────────────────
router.get('/google', authLimiter, authCtrl.googleRedirect);
router.get('/google/callback', authCtrl.googleCallback);
module.exports = router;