31 lines
906 B
JavaScript
31 lines
906 B
JavaScript
import express from "express";
|
|
import {
|
|
applicantLogin,
|
|
logout,
|
|
validatorLogin,
|
|
googleAuthStart,
|
|
googleAuthCallback,
|
|
} from "../controllers/authControllers.js";
|
|
import passport from "../services/passportService.js";
|
|
|
|
const router = express.Router();
|
|
|
|
router.post("/applicant-login", applicantLogin);
|
|
//this route is for google oauth, this one route will handle both applicantLogic and validatorLo
|
|
// we will be passing the designation as a URL parameter ("validator" or "applicant") and it will be passed as state through OAuth
|
|
router.get("/auth/oauth/:designation", googleAuthStart);
|
|
//this will be the oauth callback Route
|
|
router.get(
|
|
"/auth/google/callback",
|
|
passport.authenticate("google", {
|
|
failureRedirect: "http://localhost:5173/?error=auth_failed",
|
|
}),
|
|
googleAuthCallback,
|
|
);
|
|
|
|
router.post("/validator", validatorLogin);
|
|
|
|
router.get("/logout", logout);
|
|
|
|
export default router;
|