Skip to content

Commit

Permalink
host from server page
Browse files Browse the repository at this point in the history
  • Loading branch information
peintnermax committed Aug 2, 2023
1 parent 983cbeb commit f00e582
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 5 additions & 1 deletion apps/login/app/(login)/register/idp/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ export default async function Page({

const identityProviders = await getIdentityProviders(server, "");

const host = process.env.VERCEL_URL
? `https://${process.env.VERCEL_URL}`
: "http://localhost:3000";

return (
<div className="flex flex-col items-center space-y-4">
<h1>Register</h1>
Expand All @@ -41,7 +45,7 @@ export default async function Page({

{legal && identityProviders && process.env.ZITADEL_API_URL && (
<SignInWithIDP
instanceUrl={process.env.ZITADEL_API_URL}
host={host}
identityProviders={identityProviders}
></SignInWithIDP>
)}
Expand Down
7 changes: 2 additions & 5 deletions apps/login/ui/SignInWithIDP.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { ProviderSlug } from "#/lib/demos";

export interface SignInWithIDPProps {
children?: ReactNode;
instanceUrl: string;
host: string;
identityProviders: any[];
startIDPFlowPath?: (idpId: string) => string;
}
Expand All @@ -24,7 +24,7 @@ const START_IDP_FLOW_PATH = (idpId: string) =>
`/v2alpha/users/idps/${idpId}/start`;

export function SignInWithIDP({
instanceUrl,
host,
identityProviders,
startIDPFlowPath = START_IDP_FLOW_PATH,
}: SignInWithIDPProps) {
Expand All @@ -33,9 +33,6 @@ export function SignInWithIDP({
const router = useRouter();

async function startFlow(idpId: string, provider: ProviderSlug) {
const host = process.env.VERCEL_URL
? `https://${process.env.VERCEL_URL}`
: "http://localhost:3000";
setLoading(true);

// const path = startIDPFlowPath(idpId);
Expand Down

0 comments on commit f00e582

Please sign in to comment.