mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-21 23:47:40 +00:00
fix: saml attributes for form post
This commit is contained in:
@@ -476,17 +476,17 @@ export async function GET(request: NextRequest) {
|
|||||||
return NextResponse.redirect(url);
|
return NextResponse.redirect(url);
|
||||||
} else if (url && binding.case === "post") {
|
} else if (url && binding.case === "post") {
|
||||||
const formData = {
|
const formData = {
|
||||||
relayState: binding.value.relayState,
|
"RelayState": binding.value.relayState,
|
||||||
samlResponse: binding.value.samlResponse,
|
"SAMLResponse": binding.value.samlResponse,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Convert form data to URL-encoded string
|
const formBody = Object.entries(formData)
|
||||||
const formBody = new FormData();
|
.map(
|
||||||
|
([key, value]) =>
|
||||||
|
encodeURIComponent(key) + "=" + encodeURIComponent(value),
|
||||||
|
)
|
||||||
|
.join("&");
|
||||||
|
|
||||||
formBody.append("RelayState", formData.relayState);
|
|
||||||
formBody.append("SAMLResponse", formData.samlResponse);
|
|
||||||
console.log(url)
|
|
||||||
console.log(formBody)
|
|
||||||
// Make a POST request to the external URL with the form data
|
// Make a POST request to the external URL with the form data
|
||||||
const response = await fetch(url, {
|
const response = await fetch(url, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -495,7 +495,6 @@ export async function GET(request: NextRequest) {
|
|||||||
},
|
},
|
||||||
body: formBody,
|
body: formBody,
|
||||||
});
|
});
|
||||||
console.log(response)
|
|
||||||
|
|
||||||
// Handle the response from the external URL
|
// Handle the response from the external URL
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
|
Reference in New Issue
Block a user