21 lines
607 B
JavaScript
21 lines
607 B
JavaScript
const express = require("express");
|
|
const passport = require("passport");
|
|
const router = express.Router();
|
|
|
|
router.get("/login", passport.authenticate("oidc"));
|
|
|
|
router.get("/callback",
|
|
passport.authenticate("oidc", { failureRedirect: "/auth/login" }),
|
|
(req, res) => res.redirect("/dashboard")
|
|
);
|
|
|
|
router.get("/logout", (req, res) => {
|
|
req.logout(() => {
|
|
req.session.destroy(() => {
|
|
res.redirect("https://auth.lookatme.my.id/realms/lookatme/protocol/openid-connect/logout?post_logout_redirect_uri=https://portal.lookatme.my.id&client_id=portal");
|
|
});
|
|
});
|
|
});
|
|
|
|
module.exports = router;
|