diff --git a/apps/login/src/app/login/route.ts b/apps/login/src/app/login/route.ts
index 61daffd185..6f97f4d638 100644
--- a/apps/login/src/app/login/route.ts
+++ b/apps/login/src/app/login/route.ts
@@ -479,34 +479,37 @@ export async function GET(request: NextRequest) {
SAMLResponse: binding.value.samlResponse,
};
- // Convert form data to URL-encoded string
- const formBody = Object.entries(formData)
- .map(
- ([key, value]) =>
- encodeURIComponent(key) + "=" + encodeURIComponent(value),
- )
- .join("&");
+ const formHtml = `
+
+
+
+
+
+ Redirecting...
+
+
+
+
+
+
+ `;
- // Make a POST request to the external URL with the form data
- const response = await fetch(url, {
- method: "POST",
+ // Return the HTML response
+ return new NextResponse(formHtml, {
headers: {
- "Content-Type": "application/x-www-form-urlencoded",
+ "Content-Type": "text/html",
},
- body: formBody,
});
-
- // Handle the response from the external URL
- if (response.ok) {
- return NextResponse.json({
- message: "SAML request completed successfully",
- });
- } else {
- return NextResponse.json(
- { error: "Failed to complete SAML request" },
- { status: response.status },
- );
- }
} else {
console.log(
"could not create response, redirect user to choose other account",