Skip to content

Commit

Permalink
add handle login
Browse files Browse the repository at this point in the history
Konzisam committed Dec 9, 2024
1 parent 108404f commit 5dd6505
Showing 2 changed files with 17 additions and 3 deletions.
16 changes: 15 additions & 1 deletion frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -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() {
</div>
<h1>Car Price Estimator</h1>
<h3>Please Login to use</h3>
<button onClick={() => auth.signinRedirect()}>Sign in / Register</button>
{/* <button onClick={() => auth.signinRedirect()}>Sign in / Register</button> */}
<button onClick={handleLogin}>Sign in / Register</button>
<button onClick={() => signOutRedirect()}>Sign out</button>
</div>
);
4 changes: 2 additions & 2 deletions frontend/src/main.tsx
Original file line number Diff line number Diff line change
@@ -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,

0 comments on commit 5dd6505

Please sign in to comment.