mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-10 21:22:16 +00:00
20 lines
593 B
TypeScript
20 lines
593 B
TypeScript
import { server, startIdentityProviderFlow } from "#/lib/zitadel";
|
|
import { NextRequest, NextResponse } from "next/server";
|
|
|
|
export async function POST(request: NextRequest) {
|
|
const body = await request.json();
|
|
if (body) {
|
|
let { idpId, successUrl, failureUrl } = body;
|
|
|
|
return startIdentityProviderFlow(server, { idpId, successUrl, failureUrl })
|
|
.then((resp) => {
|
|
return NextResponse.json(resp);
|
|
})
|
|
.catch((error) => {
|
|
return NextResponse.json(error, { status: 500 });
|
|
});
|
|
} else {
|
|
return NextResponse.json({}, { status: 400 });
|
|
}
|
|
}
|