This commit is contained in:
Warunee Tamkoo 2025-02-13 13:38:04 +07:00
parent cecb85d066
commit 296e23c588

20
sso.js
View file

@ -117,9 +117,9 @@ app.post("/api/v1/sso/kcauth", async (req, res) => {
} }
// const oldssotoken = cookies['oldssotoken']; // const oldssotoken = cookies['oldssotoken'];
const olduid = cookies['olduid']; // const olduid = cookies['olduid'];
if (username !== olduid) { // if (username !== olduid) {
// create body for admin token // create body for admin token
let body = { let body = {
client_id: clientId, client_id: clientId,
@ -170,16 +170,16 @@ app.post("/api/v1/sso/kcauth", async (req, res) => {
// httpOnly: true, // httpOnly: true,
// }); // });
res.cookie('olduid', username, { // res.cookie('olduid', username, {
maxAge: 1000 * 60 * 60 * 24, // กำหนด timeout หน่วยเป็น millisecond // maxAge: 1000 * 60 * 60 * 24, // กำหนด timeout หน่วยเป็น millisecond
path: "/", // path: "/",
httpOnly: true, // httpOnly: true,
}); // });
res.status(200).send(tokenResponse.data); res.status(200).send(tokenResponse.data);
} else { // } else {
res.status(200).send({ isLogin: true }); // res.status(200).send({ isLogin: true });
} // }
} catch (error) { } catch (error) {
// console.log("error===>", error); // console.log("error===>", error);