import { getBrandingSettings, getSession, server } from "#/lib/zitadel"; import Alert, { AlertType } from "#/ui/Alert"; import DynamicTheme from "#/ui/DynamicTheme"; import RegisterPasskey from "#/ui/RegisterPasskey"; import UserAvatar from "#/ui/UserAvatar"; import { getMostRecentCookieWithLoginname } from "#/utils/cookies"; export default async function Page({ searchParams, }: { searchParams: Record; }) { const { loginName, promptPasswordless, organization, authRequestId } = searchParams; const sessionFactors = await loadSession(loginName); async function loadSession(loginName?: string) { const recent = await getMostRecentCookieWithLoginname( loginName, organization ); return getSession(server, recent.id, recent.token).then((response) => { if (response?.session) { return response.session; } }); } const title = !!promptPasswordless ? "Authenticate with a passkey" : "Use your passkey to confirm it's really you"; const description = !!promptPasswordless ? "When set up, you will be able to authenticate without a password." : "Your device will ask for your fingerprint, face, or screen lock"; const branding = await getBrandingSettings(server, organization); return (

{title}

{sessionFactors && ( )}

{description}

A passkey is an authentication method on a device like your fingerprint, Apple FaceID or similar. Passwordless Authentication {!sessionFactors && (
Could not get the context of the user. Make sure to enter the username first or provide a loginName as searchParam.
)} {sessionFactors?.id && ( )}
); }