From 5dd65054d924da7f4ba2fa2ce758320d9eb2f61a Mon Sep 17 00:00:00 2001 From: samkons Date: Mon, 9 Dec 2024 13:00:02 +0100 Subject: [PATCH] add handle login --- frontend/src/App.tsx | 16 +++++++++++++++- frontend/src/main.tsx | 4 ++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 37eed0a..cf5eeea 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -21,6 +21,19 @@ function App() { )}`; }; + const handleLogin = () => { + // Manually construct the signin URL to inspect it + const signinUrl = `${cognitoDomain}/oauth2/authorize?client_id=${client_id}&redirect_uri=${encodeURIComponent( + `${logoutUri}callback` + )}&response_type=code&scope=email+openid+phone`; + + // Log the signin URL + console.log("Signin URL:", signinUrl); + + // Proceed with the redirect + auth.signinRedirect(); + }; + useEffect(() => { if (auth.isAuthenticated) { navigate("/"); @@ -55,7 +68,8 @@ function App() {

Car Price Estimator

Please Login to use

- + {/* */} + ); diff --git a/frontend/src/main.tsx b/frontend/src/main.tsx index ed6e19a..3a13a21 100644 --- a/frontend/src/main.tsx +++ b/frontend/src/main.tsx @@ -10,8 +10,8 @@ const { cognitoAuthority, client_id, localURL } = config; const url_test = `${localURL}callback` console.log(url_test); -console.log("authority:--->", cognitoAuthority, "//") -console.log("str-",client_id,"-end") +console.log("authority:--->", cognitoAuthority, "<---") +console.log("--->",client_id,"<----") const cognitoAuthConfig = { authority: cognitoAuthority,