diff --git a/backend/.env b/backend/.env index 7fc9cd6be20056bc8f32b5133e9da97fd5efd25a..b2f01e3406153054bfcc7c1e0220cd0bb718f0c2 100644 --- a/backend/.env +++ b/backend/.env @@ -4,3 +4,5 @@ DB_USER=corps_directory_dev DB_PASSWORD=corps_db_password DB_NAME=corps_directory_db PORT=3000 + +FRONTEND_URL=localhost:8080 \ No newline at end of file diff --git a/backend/config/auth/auth.login.js b/backend/config/auth/auth.login.js index 81a21c4e1c31ba4f9f7b8bbdd02f98b36af33527..3fd269bdf400de1f8b4f3dc30128f2199e71212d 100644 --- a/backend/config/auth/auth.login.js +++ b/backend/config/auth/auth.login.js @@ -42,11 +42,9 @@ const casLogin = function (req, res, next) { // sign the token with secret key const token = jwt.sign(payload, JWT_SECRET, { expiresIn: "1h" }); - // send the token to the frontend. - res.status(200).json({ - message: "successfully authenticated.", - token: "token", - }); + // Send the JWT token to the frontend + console.log("sending JWT To: ", process.env.FRONTEND_URL); + res.redirect(`${process.env.FRONTEND_URL}/practice?token=${token}`); console.log("Successfully authenticated and generated token."); });