cleanup host on idp login

This commit is contained in:
Max Peintner
2024-12-03 10:26:44 +01:00
parent b0f991ac2c
commit d50db37fa2
2 changed files with 3 additions and 7 deletions

View File

@@ -30,10 +30,6 @@ export default async function Page(props: {
} }
} }
const host = process.env.VERCEL_URL
? `https://${process.env.VERCEL_URL}`
: "http://localhost:3000";
const loginSettings = await getLoginSettings( const loginSettings = await getLoginSettings(
organization ?? defaultOrganization, organization ?? defaultOrganization,
); );
@@ -63,7 +59,6 @@ export default async function Page(props: {
> >
{identityProviders && ( {identityProviders && (
<SignInWithIdp <SignInWithIdp
host={host}
identityProviders={identityProviders} identityProviders={identityProviders}
authRequestId={authRequestId} authRequestId={authRequestId}
organization={organization ?? defaultOrganization} // use the organization from the searchParams here otherwise fallback to the default organization organization={organization ?? defaultOrganization} // use the organization from the searchParams here otherwise fallback to the default organization

View File

@@ -6,6 +6,7 @@ import {
IdentityProvider, IdentityProvider,
IdentityProviderType, IdentityProviderType,
} from "@zitadel/proto/zitadel/settings/v2/login_settings_pb"; } from "@zitadel/proto/zitadel/settings/v2/login_settings_pb";
import { headers } from "next/headers";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { ReactNode, useState } from "react"; import { ReactNode, useState } from "react";
import { Alert } from "./alert"; import { Alert } from "./alert";
@@ -18,7 +19,6 @@ import { SignInWithGoogle } from "./idps/sign-in-with-google";
export interface SignInWithIDPProps { export interface SignInWithIDPProps {
children?: ReactNode; children?: ReactNode;
host: string;
identityProviders: IdentityProvider[]; identityProviders: IdentityProvider[];
authRequestId?: string; authRequestId?: string;
organization?: string; organization?: string;
@@ -26,7 +26,6 @@ export interface SignInWithIDPProps {
} }
export function SignInWithIdp({ export function SignInWithIdp({
host,
identityProviders, identityProviders,
authRequestId, authRequestId,
organization, organization,
@@ -53,6 +52,8 @@ export function SignInWithIdp({
params.set("organization", organization); params.set("organization", organization);
} }
const host = (await headers()).get("host");
const response = await startIDPFlow({ const response = await startIDPFlow({
idpId, idpId,
successUrl: successUrl: