diff --git a/backend/routes/oauthRouter.ts b/backend/routes/oauthRouter.ts index 554ff07..508c248 100644 --- a/backend/routes/oauthRouter.ts +++ b/backend/routes/oauthRouter.ts @@ -28,9 +28,11 @@ router.get('/google/callback', passport.authenticate('google', { session: false, }); // Redirect to the success URL - res.redirect(`${process.env.CLIENT_URL}/success`); + if(proces.env.NODE_ENV=="aws-eb") res.redirect(`/success`); + else res.redirect(`${process.env.CLIENT_URL}/success`); } else { // Redirect to the failure URL + f(proces.env.NODE_ENV=="aws-eb") res.redirect(`/failed`); res.redirect(`${process.env.CLIENT_URL}/failed`); } }); diff --git a/frontend/src/pages/auth/Login.tsx b/frontend/src/pages/auth/Login.tsx index 378f0c2..da56923 100644 --- a/frontend/src/pages/auth/Login.tsx +++ b/frontend/src/pages/auth/Login.tsx @@ -17,14 +17,13 @@ function Login() { }; console.log(import.meta.env.VITE_REACT_APP_API_URL) - + const googleAuth = (e: any) => { e.preventDefault() - // window.open( - // `http://localhost:3000/api/oauth/google/callback`, - // "_self" - // ); - window.location="http://langjam.us-east-1.elasticbeanstalk.com/api/oauth/google/callback" + window.open( + `/api/oauth/google/callback`, + "_self" + ); }; // // OR //--> The below is returning undefined in Elastic Beanstalk // const googleAuth = (e: any) => {