Skip to content

Commit

Permalink
Revert "fix: respect callbackUrl on signin redirect"
Browse files Browse the repository at this point in the history
This reverts commit cd30eba.
  • Loading branch information
Kiryous committed Nov 17, 2024
1 parent 47e3f27 commit 7100430
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions keep-ui/pages/signin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,8 @@ export async function getServerSideProps(context: any) {
};
}

export default function SignIn({
params,
}: {
params?: { amt: string; callbackUrl: string };
}) {
export default function SignIn({ params }: { params?: { amt: string } }) {
const [providers, setProviders] = useState<Providers | null>(null);
const callbackUrl = params?.callbackUrl || "/";

useEffect(() => {
async function fetchProviders() {
Expand All @@ -45,25 +40,29 @@ export default function SignIn({
console.log("Signing in with auth0 provider");
if (params?.amt) {
// Do we have a token from AWS Marketplace? redirect to auth0 with the token
signIn("auth0", { callbackUrl }, { acr_values: `amt:${params.amt}` });
signIn(
"auth0",
{ callbackUrl: "/" },
{ acr_values: `amt:${params.amt}` }
);
} else {
signIn("auth0", { callbackUrl });
signIn("auth0", { callbackUrl: "/" });
}
} else if (providers.credentials) {
console.log("Signing in with credentials provider");
signIn("credentials", { callbackUrl });
signIn("credentials", { callbackUrl: "/" });
} else if (providers.keycloak) {
console.log("Signing in with keycloak provider");
signIn("keycloak", { callbackUrl });
signIn("keycloak", { callbackUrl: "/" });
} else if (providers["azure-ad"]) {
console.log("Signing in with Azure AD provider");
signIn("azure-ad", { callbackUrl });
signIn("azure-ad", { callbackUrl: "/" });
} else {
console.log("No provider found");
console.log(providers);
}
}
}, [providers, params, callbackUrl]);
}, [providers, params]);

return <div>Redirecting for authentication...</div>;
}

0 comments on commit 7100430

Please sign in to comment.