mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-14 15:23:01 +00:00
cleanup
This commit is contained in:
@@ -24,10 +24,6 @@ export default async function Page(props: {
|
||||
|
||||
const identityProviders = await getIdentityProviders(organization);
|
||||
|
||||
const host = process.env.VERCEL_URL
|
||||
? `https://${process.env.VERCEL_URL}`
|
||||
: "http://localhost:3000";
|
||||
|
||||
const branding = await getBrandingSettings(organization);
|
||||
|
||||
return (
|
||||
@@ -38,7 +34,6 @@ export default async function Page(props: {
|
||||
|
||||
{identityProviders && (
|
||||
<SignInWithIdp
|
||||
host={host}
|
||||
identityProviders={identityProviders}
|
||||
authRequestId={authRequestId}
|
||||
organization={organization}
|
||||
|
||||
@@ -6,7 +6,6 @@ import {
|
||||
IdentityProvider,
|
||||
IdentityProviderType,
|
||||
} from "@zitadel/proto/zitadel/settings/v2/login_settings_pb";
|
||||
import { headers } from "next/headers";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { ReactNode, useState } from "react";
|
||||
import { Alert } from "./alert";
|
||||
@@ -52,14 +51,10 @@ export function SignInWithIdp({
|
||||
params.set("organization", organization);
|
||||
}
|
||||
|
||||
const host = (await headers()).get("host");
|
||||
|
||||
const response = await startIDPFlow({
|
||||
idpId,
|
||||
successUrl:
|
||||
`${host}/idp/${provider}/success?` + new URLSearchParams(params),
|
||||
failureUrl:
|
||||
`${host}/idp/${provider}/failure?` + new URLSearchParams(params),
|
||||
successUrl: `/idp/${provider}/success?` + new URLSearchParams(params),
|
||||
failureUrl: `/idp/${provider}/failure?` + new URLSearchParams(params),
|
||||
})
|
||||
.catch(() => {
|
||||
setError("Could not start IDP flow");
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use server";
|
||||
|
||||
import { startIdentityProviderFlow } from "@/lib/zitadel";
|
||||
import { headers } from "next/headers";
|
||||
|
||||
export type StartIDPFlowCommand = {
|
||||
idpId: string;
|
||||
@@ -9,11 +10,13 @@ export type StartIDPFlowCommand = {
|
||||
};
|
||||
|
||||
export async function startIDPFlow(command: StartIDPFlowCommand) {
|
||||
const host = (await headers()).get("host");
|
||||
|
||||
return startIdentityProviderFlow({
|
||||
idpId: command.idpId,
|
||||
urls: {
|
||||
successUrl: command.successUrl,
|
||||
failureUrl: command.failureUrl,
|
||||
successUrl: `${host}${command.successUrl}`,
|
||||
failureUrl: `${host}${command.failureUrl}`,
|
||||
},
|
||||
}).then((response) => {
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user