From 62e1ed6ad2f787fb32fd2d831e00ce6778bed242 Mon Sep 17 00:00:00 2001 From: Jonas Hungershausen Date: Thu, 7 Nov 2024 11:08:51 +0100 Subject: [PATCH] feat: force OIDC account selection on settings --- packages/elements-react/src/components/form/form.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/elements-react/src/components/form/form.tsx b/packages/elements-react/src/components/form/form.tsx index 4e00a861..33c8688d 100644 --- a/packages/elements-react/src/components/form/form.tsx +++ b/packages/elements-react/src/components/form/form.tsx @@ -340,8 +340,13 @@ export function OryForm({ children, onAfterSubmit, nodes }: OryFormProps) { submitData.method = "lookup_secret" } - if ("link" in submitData || "unlink" in submitData) { - submitData.method = "oidc" + // Force the account selection screen on link to provide a better use experience. + // https://github.com/ory/elements/issues/268 + // TODO: Maybe this needs to be configurable in the configuration + if (submitData.method === "oidc") { + submitData.upstream_parameters = { + prompt: "select_account", + } } if ("webauthn_remove" in submitData) {